Unicode support

LuaFAR 3

Unicode support


Passing string arguments and returning string values

The functions of the Unicode LuaFAR library assume string arguments and string return values to be in the UTF-8 encoding. (There are a few exceptions from this rule, mostly when strings are used to exchange binary data).

Calling functions on strings with colon syntax

LuaFAR modifies the __index field of the strings metatable to point to unicode.utf8 table of Selene Unicode library, rather than to string table.
That means ("abc"):match("b") is equivalent to unicode.utf8.match("abc", "b") rather than to string.match("abc", "b").
Operator # is not affected by this change.

Unicode-capable Lua libraries and functions

The following standard Lua libraries and functions were modified by LuaFAR in order to work with file names and paths in UTF-8 encoding:

  • io
  • dofile
  • loadfile
  • require
  • package.loadlib

Unicode-capable functions using Windows API