[Development] Should we change the default codec of QTextStream to UTF-8?

Thiago Macieira thiago.macieira at intel.com
Thu May 24 21:47:55 CEST 2012


On quinta-feira, 24 de maio de 2012 12.05.47, 1+1=2 wrote:
> When QT_NO_TEXTCODEC is defined, default codec is
> QTextCodec::codecForLocale(), but can be changed using
> QTextStream::setCodec().

I don't see the need to change then. It should remain the locale.

> When QT_NO_TEXTCODEC isn't defined, QString::fromLatin1()
> /QString::toLocal8Bit() is used, and they can't canged by users. I
> think this is broken for non-latin1-locale users. If they want to
> read/write the same file, it indeed will screw up user data ;-)

You misunderstand Latin 1 then. If you read the contents with Latin1 and write 
using Latin1, you get exactly what you had before. No data is lost.

That's a good behaviour, since there is no QTextCodec to change the codec.

For user applications (that is, other than qmake, moc, uic, etc.) that turned 
off QTextCodec, there's nothing that we can do. If you turn off the concept of 
codecs, then you can't change it.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120524/312962a2/attachment.sig>


More information about the Development mailing list