Re: man/man7/pathname.7: Correct handling of pathnames
From: Jason Yundt <hidden>
Date: 2025-01-28 03:06:53
On Tue, Jan 28, 2025 at 12:49:29AM +0100, Alejandro Colomar wrote:
Hi Jason, On Mon, Jan 27, 2025 at 06:07:30PM -0500, Jason Yundt wrote:quoted
quoted
I would do in a GUI exactly the same as what command-line programs do: pass the raw string to whatever API prints them. If the string makes sense in the current locale, it will be shown nicely. If it doesn't make sense, it will display weird characters, but that's not a terrible issue. Just run again with the appropriate locale.OK, but how does that API figure out what characters to display? What character encoding should that API use when drawing the characters? I think that it???s OK to replace the current recommendation, but pathname(7) should really explain how such an API would figure out what characters need to be drawn on the screen.That's not a pathname issue anymore. It's just the issue of printing bytes to a user. I don't think pathname(7) should talk about how bytes are shown to a user.
Where should it be documented, then?
That wouldn't affect at all how applications handle files. For example, I have just installed my new laptop (with the C locale), and nab's name shows as ??????. I expect a Japanese filename to be shown similarly, although that depends on what each application wants to do. It doesn't really matter, since it's just a cosmetic issue. The string still contains the appropriate bytes, even if I can't read them properly. If I had a file called nab in cyrillic, I would expect ls(1) to similarly show ??????, but internally just handle it well, because it doesn't even look at the bytes; it just passes them through. Have a lovely night! Alex -- <https://www.alejandro-colomar.es/>