[Qt-interest] QString encoding

Thiago Macieira thiago at kde.org
Thu Jul 15 22:43:09 CEST 2010


On Thursday 15. July 2010 22.22.58 Jeffery MacEachern wrote:
>  In such a case, how do I know what encoding was used
> when the QString was instantiated, so I know which
> QString::toFooFormat() method to call?

Hi Jeffery.

You're asking the wrong question.

QString is always UTF-16. So you don't have to ask what QString's encoding is.

You shouldn't care which encoding was used to decode the 8-bit data into 
UTF-16. You should only care that it was done correctly.

When converting back to 8-bit, the original encoding is also irrelevant. Only 
the encoding that your target data requires is needed. Check the API you're 
calling or the file format you're writing to to see what encoding it expects.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100715/0982aff8/attachment.bin 


More information about the Qt-interest-old mailing list