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

Tomaz Canabrava tcanabrava at kde.org
Wed Feb 11 17:23:08 CET 2015


On Wed, Feb 11, 2015 at 2:20 PM, Guido Seifert <wargand at gmx.de> wrote:

>
> 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?
>

Yes, and he already said such example, ß becomes SS


>
> 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.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150211/afd1e2d6/attachment.html>


More information about the Development mailing list