3 ms·
POSIX filenames are a series of bytes. That's all you get, and it makes things strikingly simple. Trying to wedge Unicode in at this level is a recipe for dis
by downerending 7y ago
POSIX filenames are a series of bytes. That's all you get, and it makes things strikingly simple.
Trying to wedge Unicode in at this level is a recipe for disaster, and after all these years, Python3 still doesn't have a reliable, coherent story on this.
- joshuamorton 7y ago> POSIX filenames are a series of bytes. That's all you get, and it makes things strikingly simple. But not windows, or a number of filesystems. Hell the vast majority of the time posix filenames are ASCII, and therefore utf8 compatible. The rare cases where they aren't break all kinds of other tools because... > Trying to wedge Unicode in at this level is a recipe for disaster, Blame every terminal emulator and os in common use. They all display filenames in unicode. So pythons in good company here. Since you have to display filenames, they need an encoding.
- downerending 7y agoMy chosen encoding is usually LANG=C. That is, just show me the bytes, escaped as needed (as with Python 2). Ń̸̗̮̯͇͈͇̑͒o̸̧̭̯̖̾̐̔̈́̋̈́̈́͘t̵̖̹͙̟͑̈́̎̀͝ͅ ̴̡͒͌̋̾͆̒̎ȧ̴̬̰̪̮̩͉̐̈́̋̇̀̊̕ ̷̫͑́͑̕͠f̸̬̥̼̣̙͎͍͙̤͗͆ͅā̸̛̼̱̠̯͖̫͓͙͒̔͂̅͜͝ͅń̴̨̨̨̦̺̺͗͗̉̎̓̀͘͘͠ ̵̢̖̞͍̻̮͈̘͎̹̉̇̈͐̍́̂̂̀̂o̴̳͙̿͆͝f̵̮̙̞̰͖͉̰̞͕͑̍̀̄̎̍͜ ̵̛̗̙͓̰̹͇̍̒̋͆ͅU̶̧̯͇̰̞̮͋n̵͉̰̰̳̗͎̂͑̉͛̏͛̌i̵̢̢̪͂́̽̀͝͠c̴̢͇͙̙̲̯̫͈̪̀̌̓̂͗̚͜͠ơ̷̬͖̙̯͇̻̱͕͐̎d̶̛̤͉̻͆̋͋̂̀e̵̦̺̹̅͆̀͛̎̎̅.̸̡̟̰͙̮̱͍̼̾͊̑̅͊̚͝
- joshuamorton 7y ago> That is, just show me the bytes, escaped as needed this isn't actually how python 2 works either. `print("Ń̸̗̮̯͇͈͇̑͒o̸̧̭̯̖̾̐̔̈́̋̈́̈́͘)` will print the same string, since my machine's locale is utf-8. So python2 does the same thing as 3 with regard to machine encoding.