On Sun, Jan 20, 2019 at 6:50 PM Viacheslav Usov wrote:
From the perfectionism point of view, you're correct :-)
But in practice, most use cases are covered by my module.
Your claim is: "Working with UTF-8 filenames on Windows in pure Lua"
Your solution is: "Working with a subset-of-UTF-8 filenames on Windows in pure Lua, wherein the subset is selected by arcane system configuration".
My solution is "subset-of-UTF-8 corresponding to the native language of user".
Yes, unfortunately, this approach might be not suitable for a trilingual like you :-)
Here is what looks more like perfectionism: your solution seems to ignore malformed UTF-8 inputs, and that's not good.
What would you prefer? And why?
Raising an error?
Returning "nil, err_message"?
BTW, in Lua on Linux you could create a file with malformed UTF-8 filename (just tested it): no error is raised, operation is successful.
Why Lua on Windows should check correctness of UTF-8 filenames?
Азбука Морзе. Прием на слух и передача на ключе. 1927г..djvu (fun)
Рисунки для выжигания ТРОЕ ИЗ ПРОСТОКВАШИНО.doc (fun)
Brevet de technicien supérieur (BTS).pdf (boring)
Übersendung_Vergütungsvereinbarung.pdf (boring)
It's funny, that Windows codepage 936 (Chinese Simplified) is able to render all these 4 filenames except the letter "Ü".
(If a filename is not supposed to be human-understandable, it would be better consisted of digits/hexadecimals/GUIDs/etc. instead of human language words)
What about servers that keep files for multiple users who collectively speak a bunch of languages?
Server with a lot of clients over the whole World? On Windows? Ha-ha-ha.
Even Microsoft refuses to use this OS on its own servers.
(The most popular operating system on Microsoft's Azure cloud today is -- drumroll please -- Linux.)
As I said originally, there is no way to address this with a pure Lua library, but perhaps we could hope the Lua team might recognise the importance of making the built-in libraries Unicode-friendly on Windows, even if that means using non-standard IO routines.
You are asking for too much.
This Windows-specific part would take a lot of LOC in Lua source.