From kde-commits Fri Mar 12 09:18:03 2004 From: Klas Kalass Date: Fri, 12 Mar 2004 09:18:03 +0000 To: kde-commits Subject: KDE_3_2_BRANCH: kdelibs/kdecore Message-Id: <20040312091803.3219599A2 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=107908309200713 CVS commit by kalass: The Language String is constructed by 'language (charset)', but at least in the german translation language names might contain braces. That was done for simplified and traditional chinese. So we need to search the last pair of braces, not the first one. Set encoding was broken for most charsets and applications like konqueror and kwrite in revision 1.142, the intention back then was to strip whitespaces. This patch strips white spaces correctly and does not break the string handling when there are no white spaces. CCMAIL: 75567-done@bugs.kde.org M +7 -7 kcharsets.cpp 1.144.2.1 --- kdelibs/kdecore/kcharsets.cpp #1.144:1.144.2.1 @@ -498,17 +498,17 @@ QString KCharsets::languageForEncoding( QString KCharsets::encodingForName( const QString &descriptiveName ) { - const int left = descriptiveName.find( '(' ); + const int left = descriptiveName.findRev( '(' ); if (left<0) // No parenthesis, so assume it is a normal encoding name - return descriptiveName; + return descriptiveName.stripWhiteSpace(); - QString name(descriptiveName.mid(left+2)); + QString name(descriptiveName.mid(left+1)); - const int right = name.find( ')' ); + const int right = name.findRev( ')' ); if (right<0) return name; - return name.left(right-1); + return name.left(right).stripWhiteSpace(); }