[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Could Lua itself become UTF8-aware?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 2 May 2017 09:23:46 +0200
2017-05-02 7:32 GMT+02:00 Ahmed Charles <firstname.lastname@example.org>:
> On 5/1/2017 3:27 PM, Luiz Henrique de Figueiredo wrote:
>>> When encoded as UTF-8.
>>> Looking at the manual, I can't tell whether this is intentional or not.
>>> The program, when executed, does seem to function as expected. Can you
>>> clarify if this program is intended to be valid Lua?
>> Calling print with any string is valid Lua. What you see depends on what
>> the string contains and, more to the point, on how the terminal you use
>> interprets the contents of the string. Lua is actually completely agnostic
>> about the contents of a string: strings are just sequence of bytes.
>> So, yes, A Lua program that uses UTF-8 text in Lua strings will work just
>> fine, provided you only do I/O with them. The standard string library
>> does not work on UTF-8 text. The standard utf8 library helps but does not
>> replace the standard string library.
> I guess my question wasn't clear enough. I didn't mean to focus on the
> print call. I meant to ask whether UTF-8 in comments is intended and
> whether UTF-8 in string literals is intended?
The current situation is that comments and strings are byte sequences
and anything is legal inside them.
If it looks like UTF-8 on your screen, that is because the current setting
of your locale or your clever text editor or mail client makes it look so.
At least one member of this list and I suspect several others still uses
ISO-8859-1 in e-mails and probably their comments and strings would be
ISO-8859-1 too. Note that any program that expects ISO-8859 is not fazed
by UTF-8, it just displays it wrong, whereas a program that expects UTF-8
and gets ISO-8859 is confused.