Rethinking fsinfo()
Rethinking fsinfo()
Posted Aug 23, 2020 19:08 UTC (Sun) by NYKevin (subscriber, #129325)In reply to: Rethinking fsinfo() by excors
Parent article: Rethinking fsinfo()
So, basically, pretend we have LC_ALL="[whatever].ISO-8859-1" at both ends, and then require userspace to clean up the mess if LC_ALL is actually set to a different value (which, on modern systems, is typically the case). The problem, of course, is that if you ever try to decode that JSON with a naive implementation, you will get mojibake since they will skip the "clean up the mess" step. So you still need non-naive implementations, which makes me wonder, why bother with JSON in the first place?
> If the application wants to display the path to a user, do a potentially-lossy UTF-8 decode in the UI layer, which is about the best you can ever do with Linux paths regardless of how they're encoded for transport.
Strictly, you should be consulting the locale information rather than just assuming UTF-8. UTF-8 is the most common encoding, but its use in pathnames is not required by any standard that I'm aware of. Now, you can't use something too weird such as UTF-16 (null bytes not allowed), but legacy 8-bit encodings are very much legal and valid on some older systems.
Posted Aug 23, 2020 22:44 UTC (Sun)
by shemminger (subscriber, #5739)
[Link]
Message based interfaces like netlink are more slightly more difficult to program but offer opportunity for expansion.
Rethinking fsinfo()