Manual:Unicode

From Mudlet
Revision as of 07:24, 30 June 2017 by Vadi (talk | contribs)
Jump to navigation Jump to search

Unicode

Changing encoding

Mudlet supports displaying text in many languages other than English, called encoding - this helps Mudlet display the spanish ñ, the Russian я, and many other letters. Go to Preferences > General to set the encoding:

Prefer UTF-8 if your game supports it.

Note Note: choosing the encoding will help Mudlet display the letters right, but triggers will not 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.

The list of encodings supported by Mudlet is:

Encoding Mudlet version
ASCII 3.2.0
UTF-8 3.2.0
ISO 8859-1 3.2.0
CP850 3.2.0
CP866 3.2.0
CP874 3.2.0
ISO 8859-10 3.2.0
ISO 8859-11 3.2.0
ISO 8859-13 3.2.0
ISO 8859-14 3.2.0
ISO 8859-15 3.2.0
ISO 8859-16 3.2.0
ISO 8859-2 3.2.0
ISO 8859-3 3.2.0
ISO 8859-4 3.2.0
ISO 8859-5 3.2.0
ISO 8859-6 3.2.0
ISO 8859-7 3.2.0
ISO 8859-8 3.2.0
ISO 8859-9 3.2.0
KOI8-R 3.2.0
KOI8-U 3.2.0
MACINTOSH 3.2.0
WINDOWS-1250 3.2.0
WINDOWS-1251 3.2.0
WINDOWS-1252 3.2.0
WINDOWS-1253 3.2.0
WINDOWS-1254 3.2.0
WINDOWS-1255 3.2.0
WINDOWS-1256 3.2.0
WINDOWS-1257 3.2.0
WINDOWS-1258 3.2.0

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!