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

Thiago Macieira thiago.macieira at intel.com
Mon Apr 11 17:38:05 CEST 2016


On segunda-feira, 11 de abril de 2016 11:41:13 PDT Prav wrote:
> Well ... сan you clarify your answer please?

It boils down to "in theory, theory and practice are the same; in practice, 
they're not".

In theory, the locale codec can be anything, including 16- and 32-bit codecs. 
In practice, they can't because a lot of software is going to break.

> > Whether it's single-byte or multi-byte, you can't get that information.
> > More to the point, I'd say that you should not even ask that question.
> > That indicates you're making wrong decisions and your software has design
> > flaws. Instead, redesign so you don't need to answer the question in the
> > first place.
> Ok ... probably you are right ... probably I made XY-asking mistake here ...
> sorry ... so may be I need to ask another way. How can I know that my
> QSting can be converted successfully with Local code page (local encoding)
> to signle-byte string?

Use QTextCodec and check that there were no errors during conversion.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list