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

Thiago Macieira thiago.macieira at intel.com
Wed Feb 11 00:33:12 CET 2015


On Tuesday 10 February 2015 23:17:21 Allan Sandfeld Jensen wrote:
> Maybe with C++11 we don't need QString that much anymore. Use std::string
> with UTF8 and std::u32string for UCS4.
> 
> For Qt6 it would be worth considering how many of our classes still makes
> sense. Those we want CoW semantics on would make sense, but if we don't
> really want that on strings, maybe every framework having its own string
> class is finally obsolete in C++?

Eh... have you tried to convert a UTF-8 or UTF-16 or UCS-4 string to the 
locale's narrow character set without using QString?

Have you tried to convert a number to string? You need C++14 to do that 
reasonably, since std::to_string didn't exist in C++11. How about the reverse? 
The only way to do that is sscanf or std::istringstream.

Have you tried to uppercase or lowercase a string using only the Standard 
Library?

We may want to have this discussion for QVector vs std::vector. For QString 
and QByteArray, there's no discussion: they stay, period.

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




More information about the Development mailing list