3 ms·
Does Win32 use UTF-16 or WTF-16?
by ivanbakel 8y ago
Does Win32 use UTF-16 or WTF-16?
- vardump 8y agoFor path and object names, it's the latter. WTF-16 "standard" is just UTF-16 that allows invalid surrogate pairs. Windows kernel style handling. It's a shame you were voted down for a perfectly legitimate (if misleading) question. This is a very common gotcha most developers ignore until they encounter their first invalid surrogate pair file path... UTF-16 can't represent all possible Windows file names or paths.
- ivanbakel 8y agoWas it misleading? I was just trying to understand if Win32 used WTF-16 everywhere (and some strings mostly happened to be valid UTF-16), or if there was some place where it used UTF instead.
- vardump 8y agoI think object names and paths are WTF-16, that's where NT kernel is involved. Note that Microsoft doesn't call it that way, but it's a useful naming distinction regardless. Applications can of course use whatever they please. Just need to be careful with the possible invalid object or file name surrogate pairs, not to fail on those and to pass them with alteration. Well, misleading in that sense you did get the downvotes... That said I find WTF-16 pretty appropriate name for what Windows does internally on the kernel level.
- cryptonector 8y agoIn general kernels know nothing about codesets, but filesystems do (e.g., ZFS definitely does). I call this just-use-16 and just-use-8 depending on whether the strings are arrays of bytes or of uint16_t's.
- Izkata 8y agoI'll bet they saw it and thought you were just being insulting (what-the-fuck-16), but it apparently stands for wobbly-transformation-format. Had to look this up myself to be sure.