This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dlcruz129's profile picture

Unicode Character Support

Started by Dlcruz129, 03 December 2012 - 08:02 AM
Dlcruz129 #1
Posted 03 December 2012 - 09:02 AM
So, I wanted to translate my Operating System to Spanish, German, Etc. but ComputerCraft doesn't have Unicode Character Support. Is this a limitation of Forge, or could this be added? It would be really useful for translations. Thanks.
ChunLing #2
Posted 03 December 2012 - 10:52 AM
Pretty sure there was an old thread that this was confirmed to be in the works…but hasn't come out yet.
faubiguy #3
Posted 03 December 2012 - 03:42 PM
I like the idea, but a limitation is that the lua string library wouldn't directly work with Unicode strings, because Lua strings use 8-bit characters (CC uses ASCII), and Unicode uses 16-bit characters (For variable-width encodings like UTF-8, it depends on the character being encoded, but that doesn't make manipulating Unicode strings any easier).
Orwell #4
Posted 03 December 2012 - 04:47 PM
The extended ASCII set could be used. It has most of those foreign characters (not like chinese/japanese/korean/arabic/… though). It also has a lot of typically useless characters (rectangles, corners, lines), but those could actually be useful in ComputerCraft.
Dlcruz129 #5
Posted 03 December 2012 - 07:08 PM
I like the idea, but a limitation is that the lua string library wouldn't directly work with Unicode strings, because Lua strings use 8-bit characters (CC uses ASCII), and Unicode uses 16-bit characters (For variable-width encodings like UTF-8, it depends on the character being encoded, but that doesn't make manipulating Unicode strings any easier).

You're saying that in standard Lua, print("À") won't work?
faubiguy #6
Posted 03 December 2012 - 08:44 PM
You're saying that in standard Lua, print("À") won't work?

The lua specification does not specify a character encoding to use, only that it uses 8 bits per character.

With the lua 5.1 standalone interpreter, the code
print("À")
will fail to compile when encoded UTF-8 or UCS-2, and when encoded in ASCII, instead prints
À
Y.Petremann #7
Posted 04 December 2012 - 03:09 PM
I don't really agree with Unicode support since it's more dificult to work with Unicode ( UTF-x ) than with ASCII, since for now ComputerCraft don't have a full ASCII support and since /font/default.png font can be easily monospaced and that not pretty good for Unicode charset.