Difference between revisions of "Manual:Unicode"
(→Changing encoding: Revised to correct definition of what an encoding is...)
|Line 160:||Line 160:|
> 5 -- correct!
> 5 -- correct!
Latest revision as of 10:51, 8 July 2019
Mudlet is being developed to support displaying text in many languages but how the characters that conveys that language varies between MUDs as does the languages they support. Plain vanilla Telnet actually only supports the 96-characters of ASCII by default, but other language can be supported if the way that they are converted into 8-bit bytes can be agreed upon by the use of what is called encoding - setting Mudlet (and the MUD server if approriate) to the correct encoding allows the correct display of characters like the Spanish ñ, the Russian я, and all other letters (or more properly grapheme).
Go to Preferences > General to set the encoding:
Note: choosing the encoding will help Mudlet display the letters right, but triggers will not currently work with non-English text and nor will some Lua string. functions like string.len(). We'll be adding these features incrementally and it will all be ready in Mudlet 4.0. Prior to the work commencing toward this in Mudlet 3.x the only encodings that was understood were ASCII and the Latin 1 (ISO 8859-1) encoding - the latter being covered because it is the default (using 8-bits and having character codes in the range 0 to 255) for the Qt Libraries and like all the other ISO 8859 ones is a super set that has the same codes in the range (0 to 127) as ASCII...
The list of encodings supported by Mudlet is:
Scripting with Unicode
Mudlet uses English in all of its Lua API to enable scripts scripts to be international - so a script written on a computer with German default will work on a computer with English default, for example. This means you can expect all API functions, error messages to be in English, and the number separator is always a period
. Mudlet sets
os.setlocale("C") by default, see background.
Not all Lua functions beginning with
string. will work with Unicode - Mudlet has
utf8. equivalents for those. See String functions in Mudlet for a complete list. For example:
print(string.len("слово")) > 10 -- wrong! print(utf8.len("слово")) > 5 -- correct!
Loading external Lua files
Mudlet uses Unicode (utf8) for the trigger engine and Lua subsystem. If you have a file you're loading externally with Lua, make sure it saved in utf8 encoding.