[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unexpected result using file:read("l")
- From: Scott Morgan <blumf@...>
- Date: Mon, 28 Mar 2022 12:31:29 +0100
On 3/28/22 09:35, Thijs Schreijer wrote:
I think the trend is that files become more and more cross-platform, and
if that’s the case, then both options “*l” and “*L” are just becoming
big foot guns because you cannot rely on them, and should either be
removed from the implementation, or be made consistent across platforms.
Hummm... so Lua should automatically be able to detect if the file is in
EBCDIC encoding? (LF == 0x25)
How about handling UTF16 or UTF32 encodings? Should it automatically
skip the BOM mark on those files? (tip; Windows apps tend to drop in the
BOM on UTF8 encoded files, but not always)
At the least it should have support for the various local 8-bit code
pages, yeah? Convert them to your preferred encoding.
Where do you propose drawing the line?
Ultimately, there is no such thing as a "text file", just a messy
collection of conventions that may not hold, even within a single OS
install. It's down to you, the programmer, to understand this and
specify what is acceptable. It's not Lua's job.
Scott