[Interest] It is possible to get the actual name of a local character set?

Nikos Chantziaras realnc at gmail.com
Wed Dec 26 14:54:25 CET 2012


I need the actual name of the character set from which 
QFile::decodeName() is converting.  The docs say that it's the "local 
8-bit encoding."

I'm not sure what that means, but I suppose it's the codec returned by 
QTextCodec::codecForLocale().  Unfortunately, this:

   QTextCodec::codecForLocale()->name()

returns "System" on platforms that come with a Qt that uses ICU (pretty 
much all Linux distributions.)  With an ICU-less Qt build, I get the 
correct name, like "UTF-8" or "UTF-16LE", which what I need.

Is there anything I can do?  And are QFile's decodeName() and 
encodeName() functions actually using the codecForLocale() codec to 
begin with?




More information about the Interest mailing list