[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua interpreter and Lua files encoding
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 6 Jan 2011 10:59:55 -0200
> 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