lua-users home
lua-l archive

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

Thanks for the replies on this. So I will do when loading files but not when loading strings as this seems reasonable.


On 11 August 2016 at 21:05, Egor Skriptunoff <> wrote:
BOMs in ascii or utf-8 documents is a bug, period. 
Given that this bug is so prevalent, we decided to handle it,
but it is a kind of "implementation detail". Documenting it would sound
like a recognition that utf-8 BOMs could have some place in a reasonable

utf-8 BOMs does have place in a reasonable world.
On Linux you don't need BOMs because utf-8 is actually the only encoding in a widespread use.
But there are other OS in the "reasonable world".

Imagine that your country is being ruled by a king (utf-8), so there is no need for democracy mechanisms (BOMs).
Does it mean that there is no place for democracy in the whole world? 
Of course, not.  Not all the people want tyranny.
For example, in another country (Windows) there are three political parties (win1252, utf-16, utf-8),
so it is very necessary to have something (BOMs) to make sure their rights are equal.

Actually, it is a common case to have text files in different encodings next to each other in the same directory on Windows.
BOMs are very useful here: you don't need to guess the encoding,
you don't need to read the whole file to detect its encoding by searching for prohibited combinations of bytes.
Reading its first few bytes is enough!

BTW, it's a pity that Lua.exe is unable to execute BOM-ed UTF-16 Lua program...

P.S.  Sorry for politics in this mail list :-)