[Development] The life of a file name and other possibly mal-encoded strings on non-Windows systems

Kuba Ober kuba at mareimbrium.org
Mon Oct 6 17:12:57 CEST 2014

I’ve just read Armin Ronacher’s blog post about Unicode in Python 3, and he has highlighted a possible problem with “Unicode everywhere” approach to things that come from byte APIs like one has on Unix.

File names can have any encoding, and a file name not being valid under the encoding given in LC_CTYPE or LANG shouldn’t cause any failures when attempting to open the file. After all, when using the byte APIs, everything “just works”. About the only problem might be when presenting the name to the user, but even then, the name must simply exist in two forms: the native byte form, and a QString with some question marks in it.

Thus, how does Qt deal with a directory listing with such “invalid” file names? Do they survive the round-trip through a QString and QDirIterator? Would it be worthwhile to tackle this issue in a better fashion (whatever it might be) for Qt 6?

Cheers, Kuba Ober

More information about the Development mailing list