Yakov Galka wrote:
That's not convincing. Why Windows has to be different in this regard?
Because it is. The file name on Windows physically is a sequence of uint16_t, whereas on Linux, it's a sequence of uint8_t. On Linux, any null-terminated byte sequence results in a perfect roundtrip, as it's stored unmodified, it's literally the exact same byte sequence as the one you gave. If the library tried to mess with the file name in any way, this would result in nothing but problems. On Windows, it is simply not possible to have the exact same byte sequence stored as the file name. The file system does not use byte sequences, it uses uint16_t sequences. (Mac OS X also stores uint16_t by the way, and the functions require UTF-8. So it's not quite POSIX vs Windows.)