[Qt-interest] QString Special Character Problem

suzuki toshiya mpsuzuki at hiroshima-u.ac.jp
Mon Oct 3 13:35:06 CEST 2011


Hi,

I guess your request is asking for the reflection of the Turkish
locale to case-conversion. Yet I've not tested with some code
snippet, checking the source qstring.cpp, it seems that there are
locale-aware string comparing methods, but toUpper/toLower methods
of QString object is locale-unaware.


/*!
    Returns a lowercase copy of the string.

    \snippet doc/src/snippets/qstring/main.cpp 75

    The case conversion will always happen in the 'C' locale. For locale dependent
    case folding use QLocale::toLower()

    \sa toUpper(), QLocale::toLower()
*/

QString QString::toLower() const


QLocale object has locale-aware toUpper/toLower methods, but if
Qt is built without ICU, it will be locale-unaware.

/*!
  \since 4.8

  Returns a lowercase copy of \a str.
*/
QString QLocale::toLower(const QString &str) const
{
#ifdef QT_USE_ICU
    {
        QString result;
        if (qt_u_strToLower(str, &result, *this))
            return result;
        // else fall through and use Qt's toUpper
    }
#endif
    return str.toLower();
}

Thus, your issue could be dependent with your platform & options
in building Qt.

If you can work for Qt with specific build options, there might be
some solution, but if you have to work with all Qt, it would be hard.

Regards,
mpsuzuki

hakiim the dream wrote:
> Hi,
> 
> I have a problem with Turskish special characters, especially 'ı' (not 'i') in QStrings.
> 
> The exact problem is that, I must handle upper-to-lower/lower-to-upper 
> conversions for any strings which may even include those special 
> characters. For an example, I'd like to convert the word "Image" into 
> "ımage", not to "image" etc.
> 
> Any help welcome.
>  		 	   		  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list