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 transformation function or a table of chars [ASCII-code] -> [UTF-code] or anything to provide the conversion?
Something like:
\startluacode local str = loadFile("a.txt") -- ASCII coded
str = context.ACSII2UTF(str) -- Or something like this \stopluacode
Best regards,
Lukas
Have a look at tex/texmf-context/scripts/context/lua/mtx-babel.lua. That's a converter Hans wrote a while ago for a similar problem I had. I don't know if it still works out of the box, but it should help you get an idea what you could do. Thomas