[Qt-interest] QString::toLower() issues with two-byte chars
Girish Ramakrishnan
girish at forwardbias.in
Fri Mar 12 07:01:44 CET 2010
Øyvind Vågen Jægtnes wrote:
> Hi,
>
> I have some problems using QString::toLower() on strings containing
> norwegian chars.
>
> A simple test program:
>
> #include <QtDebug>
>
>
> int main(int argc, char **argv)
> {
> qDebug() << QString("æøå").toLower();
> return 0;
> }
>
The QString(char *) constructor assumes that the c-style string is
ASCII. The above code is equivalent to
QString::fromAscii("æøå").toLower() which is not what you want.
So, do QString::fromUtf8("æøå") and then you will get expected results.
Girish
More information about the Qt-interest-old
mailing list