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

Nikos Chantziaras realnc at gmail.com
Wed Dec 26 15:23:30 CET 2012


On 26/12/12 16:16, Thiago Macieira wrote:
> On quarta-feira, 26 de dezembro de 2012 15.54.25, Nikos Chantziaras wrote:
>> I need the actual name of the character set from which
>> QFile::decodeName() is converting. [...]  Unfortunately, this:
>>
>>     QTextCodec::codecForLocale()->name()
>>
>> returns "System" on platforms that come with a Qt that uses ICU (pretty
>> much all Linux distributions.) [...]
>>
>> Is there anything I can do?
>
> There is no Qt API to return that value. You can use the Windows API, POSIX
> API or ICU API to find out by yourself.

Too bad.

Though the API *is* there.  It's QTextCodec::name() and 
QTextCodec::aliases().  IMO it's a mistake by Qt to return "System" 
there, since "System" has exactly zero use.  Or at least 
QTextCodec::aliases() should contain the actual name in one of its elements.




More information about the Interest mailing list