[Interest] Why there is no QChar::toLocal8Bit()?

Nikos Chantziaras realnc at gmail.com
Sun Apr 10 01:11:01 CEST 2016


On 10/04/16 01:33, Prav wrote:
> Hi, Konstantin Tokarev and Thiago Macieira.
>
>
>> For example, popular choice for Local8Bit encoding is UTF-8, which is multibyte.
> Thanks!
>
> As soon as toLocal8Bit is said to use codecForLocale ... does it mean that returned
> by codecForLocale codec is always 8-bit multibyte codec?

No. It is the local character set. It's usually multibyte, but on some 
systems it might not be. I can set up my Linux installation to use ASCII 
for example. On that system, toLocal8Bit would give you ASCII, which is 
single-byte. Or, I could use an ISO character set like 8859-n. Those are 
single-byte too.

So never assume that toLocal8Bit will always give you a single-byte or 
multi-byte string. It varies not only per OS, but also per user.




More information about the Interest mailing list