Re: [NTG-context] UTF conversion via Lua

2012-02-17 Thread Procházka Lukáš Ing . - Pontex s . r . o .
On Fri, 17 Feb 2012 09:19:16 +0100, Hans Hagen wrote: On Thu, 16 Feb 2012 23:56:44 +0100, Hans Hagen wrote: regimes.toregime('8859-1',"abcde Ä","?") but you'll have to test and wikify it. Wikified - http://wiki.contextgarden.net/Encodings_and_Regimes#Conversion_between_encodings. Lukas

Re: [NTG-context] UTF conversion via Lua

2012-02-17 Thread Hans Hagen
On 17-2-2012 09:09, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello Hans, thank you for the extension; I've tested and it works perfectly. On Thu, 16 Feb 2012 23:56:44 +0100, Hans Hagen wrote: regimes.toregime('8859-1',"abcde Ä","?") but you'll have to test and wikify it. I'll going t

Re: [NTG-context] UTF conversion via Lua

2012-02-17 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Hello Hans, thank you for the extension; I've tested and it works perfectly. On Thu, 16 Feb 2012 23:56:44 +0100, Hans Hagen wrote: regimes.toregime('8859-1',"abcde Ä","?") but you'll have to test and wikify it. I'll going to wikify it - - I supppose: regimes.toregime(, , ) so qu

Re: [NTG-context] UTF conversion via Lua (renaming attachments to .scr_)

2012-02-16 Thread Hans Hagen
On 16-2-2012 14:14, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Would it be possible to provide this? I'll provide: regimes.toregime('8859-1',"abcde Ä","?") but you'll have to test and wikify it. Hans -

Re: [NTG-context] UTF conversion via Lua (renaming attachments to .scr_)

2012-02-16 Thread Procházka Lukáš Ing . - Pontex s . r . o .
On Thu, 16 Feb 2012 13:08:09 +0100, Hans Hagen wrote: no, although it's no big deal to provide that (of course there is then the matter of utf being more complete than the target) src_enc = "utf8" tgt_enc = "cp1250" str = regimes.translate(str, src_enc, tgt_enc) is there a reason

Re: [NTG-context] UTF conversion via Lua

2012-02-16 Thread Hans Hagen
On 16-2-2012 12:13, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello, one more question - - does "regimes.translate" allow to translate between arbitrary encodings or only from the specified to the current one? no, although it's no big deal to provide that (of course there is then the mat

Re: [NTG-context] UTF conversion via Lua

2012-02-16 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Hello, one more question - - does "regimes.translate" allow to translate between arbitrary encodings or only from the specified to the current one? str = regimes.translate(str, "cp1250") -- = Translate from "cp1250" to the current encoding (UTF) (or always to UTF?) I'm looking fo

Re: [NTG-context] UTF conversion via Lua

2012-02-13 Thread luigi scarso
On Mon, Feb 13, 2012 at 12:42 PM, Ulrike Fischer wrote: > Am Fri, 10 Feb 2012 12:14:15 +0100 schrieb luigi scarso: > >> if you mean ASCII with coderange 0-255 *and*  ISO-8859-1 (Latin 1) >> encoding there is no need to conversion; > > This is not true. You are mixing up unicode positions and utf8

Re: [NTG-context] UTF conversion via Lua

2012-02-13 Thread Ulrike Fischer
Am Fri, 10 Feb 2012 12:14:15 +0100 schrieb luigi scarso: > if you mean ASCII with coderange 0-255 *and*  ISO-8859-1 (Latin 1) > encoding there is no need to conversion; This is not true. You are mixing up unicode positions and utf8 encoding. E.g. "ä" has the same position in unicode and latin1 (

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Hans Hagen
On 10-2-2012 14:15, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Dunno but it works when you use “regimes.translate” in your code but it’s better to ask Hans for a function in the commands namespace which you can use. \starttext \startluacode function loadFile(fn) local fh = assert(io.open(fn

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Dunno but it works when you use “regimes.translate” in your code but it’s better to ask Hans for a function in the commands namespace which you can use. \starttext \startluacode function loadFile(fn) local fh = assert(io.open(fn, "r")) local str = fh:read("*all") fh:close() str

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Wolfgang Schuster
Am 10.02.2012 um 12:32 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > ... \enableregime - nice idea! > > Despite this, I'm still not able to make work the example: > > Test.mkiv > \enableregime[cp1250] > > \starttext > \startluacode >function loadFile(fn) > local fh = assert(

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .
One more note - On Fri, 10 Feb 2012 12:15:29 +0100, Wolfgang Schuster wrote: Why don’t you let do context the conversion: \starttext this is something in utf8 \startregime[cp1250] \input filewithcp1250encoding \stopregime more text encoded in utf8 \stoptext I cannot \input the file as

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .
... \enableregime - nice idea! Despite this, I'm still not able to make work the example: Test.mkiv \enableregime[cp1250] \starttext \startluacode function loadFile(fn) local fh = assert(io.open(fn, "r")) local str = fh:read("*all") fh:close() return str

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Philipp Gesang
On 2012-02-10 12:11, Procházka Lukáš Ing. - Pontex s. r. o. wrote: > ... Well, my information was not correct. > > There are characters > 127 in the file, like "ř", "š"... > > Each char = 1 byte, and as I'm using Windows with CP 1250, the characters are > displayed correctly. So it wasn’t ASCII

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Wolfgang Schuster
Am 10.02.2012 um 12:11 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > ... Well, my information was not correct. > > There are characters > 127 in the file, like "ř", "š"... > > Each char = 1 byte, and as I'm using Windows with CP 1250, the characters are > displayed correctly. > > But I ha

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread luigi scarso
2012/2/10 Procházka Lukáš Ing. - Pontex s. r. o. : > ... Well, my information was not correct. > > There are characters > 127 in the file, like "ř", "š"... > > Each char = 1 byte, and as I'm using Windows with CP 1250, the characters > are displayed correctly. > > But I have problem loading them in

Re: [NTG-context] UTF conversion via Lua (now with attachment)

2012-02-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .
... Well, my information was not correct. There are characters > 127 in the file, like "ř", "š"... Each char = 1 byte, and as I'm using Windows with CP 1250, the characters are displayed correctly. But I have problem loading them into ConTeXt. I need to convert the bytes > 127 to UTF sequence

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .
... Well, my information was not correct. There are characters > 127 in the file, like "ř", "š"... Each char = 1 byte, and as I'm using Windows with CP 1250, the characters are displayed correctly. But I have problem loading them into ConTeXt. I need to convert the bytes > 127 to UTF sequence

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Philipp Gesang
On 2012-02-10 11:22, Procházka Lukáš Ing. - Pontex s. r. o. wrote: > Hello, > > I have many files with ASCII encoding; this encoding must be kept as these > files are processed also by another program. > > When I work with them in ConTeXt, I need to convert them to UTF. Not needed, as every ASC

Re: [NTG-context] UTF conversion via Lua

2012-02-10 Thread Thomas A. Schmitz
On 02/10/12 11:22, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello, I have many files with ASCII encoding; this encoding must be kept as these files are processed also by another program. When I work with them in ConTeXt, I need to convert them to UTF. Does Lua (in ConTeXt scope) offer a t

[NTG-context] UTF conversion via Lua

2012-02-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Hello, I have many files with ASCII encoding; this encoding must be kept as these files are processed also by another program. When I work with them in ConTeXt, I need to convert them to UTF. Does Lua (in ConTeXt scope) offer a transformation function or a table of chars [ASCII-code] -> [UTF-