[Qt-interest] QString::toLower() issues with two-byte chars

Øyvind Vågen Jægtnes oyvind at jaegtnes.no
Fri Mar 12 04:22:47 CET 2010


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;
}

Even if the chars in the qstring are already lowercase,
QString::toLower() thinks that the first char in these two byte chars
is uppercase and will "lower" them making the output garbage.

Another problem is QString::count() giving me the length of 6 for the
above string. When using count(QRegExp("\\w")) it will return 3 as
expected, but that is a bit heavy for counting chars in a string ;)

Are there any ways around these problems that i can not find?

Software:
Qt 4.5.2 under linux.

-- 
Øyvind Vågen Jægtnes
+47 96 22 03 08

(i reject your diurnal rhythm and subsitute my own)



More information about the Qt-interest-old mailing list