From: Philipp Gesang <gesang@stud.uni-heidelberg.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: UTF conversion via Lua
Date: Fri, 10 Feb 2012 12:30:23 +0100 [thread overview]
Message-ID: <20120210113023.GB30993@phlegethon> (raw)
In-Reply-To: <op.v9gmovrzwshuv7@lpr>
[-- Attachment #1.1: Type: text/plain, Size: 3938 bytes --]
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 after all ;-) No problem, just use iconv:
iconv -f CP1250 -t UTF8 infile > outfile
I do this a lot with movie subtitles …
Hth, Philipp
PS: If you still insist on converting at the Lua end only then
your starting point might be “regi-cp1250.lua” in the
Context base/ dir.
>
> But I have problem loading them into ConTeXt.
>
> I need to convert the bytes > 127 to UTF sequence, which would be acceptable by ConTeXt.
>
> @Thomas:
>
> The table looks nice but there are no entries for CP 1250 to UTF conversion.
>
> I prepared some tables: character conversion and removal of diacritics (see the attachment);
> maybe it would be handful to include them into ConTeXt somehow.
>
> Best regards,
>
> Lukas
>
>
> On Fri, 10 Feb 2012 11:57:32 +0100, Philipp Gesang <gesang@stud.uni-heidelberg.de> wrote:
>
> >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 ASCII string is a valid UTF8 string:
> > “The UTF encoding has several good properties. By far the most
> > important is that a byte in the ASCII range 0-127 represents
> > itself in UTF. Thus UTF is backward compatible with ASCII.”
> > http://doc.cat-v.org/plan_9/4th_edition/papers/utf
> >You can use them in Luatex without further conversion.
> >
> >Regards
> >Philipp
> >
> >
> >>
> >>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
> >>
> >>
> >>--
> >>Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
> >>Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz]
> >>Bezová 1658
> >>147 14 Praha 4
> >>
> >>Tel: +420 244 062 238
> >>Fax: +420 244 461 038
> >>
> >>___________________________________________________________________________________
> >>If your question is of interest to others as well, please add an entry to the Wiki!
> >>
> >>maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> >>webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> >>archive : http://foundry.supelec.fr/projects/contextrev/
> >>wiki : http://contextgarden.net
> >>___________________________________________________________________________________
> >
>
>
> --
> Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
> Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz]
> Bezová 1658
> 147 14 Praha 4
>
> Tel: +420 244 062 238
> Fax: +420 244 461 038
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2012-02-10 11:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 10:22 Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 10:26 ` Thomas A. Schmitz
2012-02-10 10:57 ` Philipp Gesang
2012-02-10 11:11 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 11:14 ` luigi scarso
2012-02-13 11:42 ` Ulrike Fischer
2012-02-13 13:14 ` luigi scarso
2012-02-10 11:15 ` Wolfgang Schuster
2012-02-10 11:32 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 12:25 ` Wolfgang Schuster
2012-02-10 13:15 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 15:08 ` Hans Hagen
2012-02-16 11:13 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-16 12:08 ` Hans Hagen
2012-02-16 13:15 ` UTF conversion via Lua (renaming attachments to .scr_) Procházka Lukáš Ing. - Pontex s. r. o.
[not found] ` <op.v9rwejuttpjj8f@lpr>
2012-02-16 22:56 ` Hans Hagen
2012-02-17 8:09 ` UTF conversion via Lua Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-17 8:19 ` Hans Hagen
2012-02-17 9:20 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 11:40 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-02-10 11:30 ` Philipp Gesang [this message]
2012-02-10 11:13 ` UTF conversion via Lua (now with attachment) Procházka Lukáš Ing. - Pontex s. r. o.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120210113023.GB30993@phlegethon \
--to=gesang@stud.uni-heidelberg.de \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).