lua-users home
lua-l archive

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


The so-called UTF-8 BOM isn't really a byte order mark at all, it's a
constant three-byte sequence. Lua would not need to do any more to
support it than skip those three bytes if they occur right at the
start (they cannot occur there naturally in a Lua script). This could
be done by replacing loadstring/loadfile with your own versions. As a
Lua string the BOM is "\239\187\191".

(I'm not strongly advocating that this be included in Lua, it's
certainly a Windows-specific curiosity. But then again I see from the
source of luaL_loadfile() that Lua is already sympathetic to the
Unix-specific curiosity that the first line needs to be skipped it
starts with a #. So this kind of thing is not completely
unprecedented.)

-Duncan

On Sun, May 31, 2009 at 11:25 AM, Gabríel A. <gabrielp@simnet.is> wrote:
> Lua has no special support for UTF-8, let alone BOM markers. You should
> simply tell your users to configure their editors properly or use a
> different editor.
>
> On Sun, 2009-05-31 at 14:23 +0400, Bulat Ziganshin wrote:
>> Hello Lua,
>>
>> i use UTF8 encoding for string data and so my users editing scripts
>> should use UTF8 editors. the most well-known windows one, Notepad,
>> adds BOM to the beginning of UTF8-encoded files
>>
>> may be Lua interpreter should ignore BOM at beginning of file/string
>> it executes?
>>
>
>