lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27/02/10 18:21, Sam Roberts wrote:
[...]
> Then only windows would have to special, unless you have less there,
> you might have
> to use more.

Windows is extremely special, and its terminal basically doesn't do
encodings.

It *is* possible to persuade the console to accept UTF-8, but you have
to use special Windows-specific calls to output data rather than just
doing printf(); and the standard bitmap fonts don't do font substitution
anyway so you're still limited to the ANSI character set (anything else
just shows up as ?). You *can* do a nasty registry hack to force the
console to use a real font, but it's still highly unsatisfactory.

You can see the code I did for WordGrinder here:

http://wordgrinder.svn.sourceforge.net/viewvc/wordgrinder/wordgrinder/src/c/arch/win32/console/dpy.c?revision=159&view=markup

It is all C, alas. Also, here:

http://wordgrinder.svn.sourceforge.net/viewvc/wordgrinder/wordgrinder/src/c/utils.c?revision=159&view=markup

...are simple C routines (and Lua bindings thereof) for reading and
writing UTF-8 strings.

(My eventual solution to this mess was to write my own custom console
using raw GDI calls. It turns out to be about 2000 lines of code. The
WordGrinder source itself is only 6000...)

- -- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ 𝕻𝖍'𝖓𝖌𝖑𝖚𝖎 𝖒𝖌𝖑𝖜'𝖓𝖆𝖋𝖍 𝕮𝖙𝖍𝖚𝖑𝖍𝖚
│ 𝕽'𝖑𝖞𝖊𝖍 𝖜𝖌𝖆𝖍'𝖓𝖆𝖌𝖑 𝖋𝖍𝖙𝖆𝖌𝖓.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLiloGf9E0noFvlzgRAupZAJ99qChoTGHyahf4sWyrHGwyIPbNgQCfWA4q
ZsKERL6dFoyODy80j7b/ORE=
=iW5u
-----END PGP SIGNATURE-----