From kde-bugs-dist Fri Mar 12 09:18:07 2004 From: Klas Kalass Date: Fri, 12 Mar 2004 09:18:07 +0000 To: kde-bugs-dist Subject: [Bug 75567] Set encoding does not work Message-Id: <20040312091807.8308.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-bugs-dist&m=107908309803103 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. http://bugs.kde.org/show_bug.cgi?id=75567 klas.kalass gmx de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Additional Comments From klas.kalass gmx de 2004-03-12 10:18 ------- 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(); }