lua-users home
lua-l archive

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


> I know Lua can _store_ any octet sequence in a string. The doubt is
> with the interpreter executable: can it read and always parse a utf8
> file with non-ASCII chars in some literals/comments?

The problem is that it depends on the system's file manipulation. Lua
uses regular fread functions in text mode to read a source file. If
these functions manipulate the file contents in any way (e.g., changing
newlines), there is not much that Lua can do about it.

The manual says:

  You should not use long strings for non-text data;
  Use instead a regular quoted literal with explicit escape sequences
  for control characters.

The notion of "non-text data" and "control characters" is system
dependent. If your system does not corrupt UTF-8 sequences (that is,
does not treat them as some kind of "control characters"), all will
be fine.

-- Roberto