[Development] Deprecating QFile::encodeName/decodeName

João Abecasis joao.abecasis at nokia.com
Fri Jun 8 12:53:00 CEST 2012


Thiago Macieira wrote:
>> the lesser evil is imo assuming correct locale encoding when actually
>> interpreting external input, being consistent within the qt realm when
>> dealing with i/o functions, and having functions for 8-bit pass-through
>> when dealing with external things which are just passed along
>> (qprocessenvironment already has this; it should be possible to do the
>> same for cmdline args by having laszlo's work integrate with qprocess as
>> well).
> 
> I agree on that too. Which is why I am telling João that the idea that 
> filesystem encoding != locale encoding is insane. It simply cannot be 
> implemented properly.

We're not discussing whether it's sane or not. I'm interested in enabling the user to act on "broken" files from within Qt applications. Qt is a general purpose toolkit, it should not unnecessarily limit what you can do, even if it makes you jump through hoops in some cases.

Qt can see these broken file names and will point them out with a healthy dose of '?'. How do application developers explain to their users that the files they see they don't really? "Yeah, just ignore those, your filesystem is corrupted. There are plenty other files you can play with. Here, have a balloon!"

As I see it, enabling command-line arguments to be treated as random 8-bit gibberish is a separate and specific problem. I don't think encode/decodeName is the right concept to use there, though we could very well have an encode/decodeCmdLineArg pair. It might suffer from the same shortcomings of current encode/decodeName in terms of portability, though.

Cheers,


João




More information about the Development mailing list