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

Guido Seifert wargand at gmx.de
Wed Feb 11 17:20:04 CET 2015


Minor OT, but I am too curious... do you have an example?
Are there really cases were turning lower case into upper case or
vice versa changes the length of a string?

Guido 

> > std::string s("hello");
> > std::transform(s.begin(), s.end(), s.begin(), ::toupper);
> > 
> > and
> > std::transform(s.begin(), s.end(), s.begin(), ::tolower);
> > 
> > Not sure about the performance though
> 
> That's flawed by construction. Uppercasing and lowercasing are string 
> operations, since it can change length, *especially* if you do it in UTF-8.



More information about the Development mailing list