[Development] Why can't QString use UTF-8 internally?

Thiago Macieira thiago.macieira at intel.com
Tue Feb 10 22:49:35 CET 2015


On Tuesday 10 February 2015 13:26:50 Thiago Macieira wrote:
> But given the choice, I would choose to do nothing. Instead, I have a patch 
> pending for Qt 6 that caches the Latin1 version of the QString in an extra
> block past the UTF-16 data.

Sorry, I remembered wrong. I have a patch that sets a bit indicating whether 
the QString data is ASCII-only. If it is, then toUtf8() can actually use the 
faster toLatin1() conversion. But there's no memory caching because we need to 
return a QByteArray anyway.

https://qt.gitorious.org/qt/thiago-intels-qtbase/source/master:src/corelib/tools/qstring.cpp#L4476
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list