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

1+1=2 dbzhang800 at gmail.com
Thu May 24 19:05:50 CEST 2012


On Thu, May 24, 2012 at 2:51 AM,  <lars.knoll at nokia.com> wrote:
> Not true. We do compile qutfcodec into qmake and the bootstrap tools, so
> QString::fromUtf8() does work.  With the change of QString(const char *)
> to convert from utf8 I would assume that qmake at least partially uses
> utf8 by now.
>
> I think it makes sense to also require utf8 encoding of .pro files to be
> consistent. Also, that's the only way we can get non latin paths to work.
>

Yes, QUtf8::convertFromUnicode() and QUtf8::convertToUnicode() which
are used by QString::from/toUtf8() can be used in bootstrap tools
directly, but they can't be used through QTextStream.

At present, when QT_NO_TEXTCODEC is defined, QTextStream use
QString::fromLatin1() /QString::toLocal8Bit()
to convert from/to bytes which looks like not very well. So I think it
will be better to replace them with QUtf8::convertFromUnicode() and
QUtf8::convertToUnicode().

Any suggestion?

Debao



More information about the Development mailing list