[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Klas Kalass <klas.kalass () gmx ! de>
Date:       2004-03-12 9:19:42
Message-ID: 20040312091942.1F29099A8 () office ! kde ! org
[Download RAW message or body]

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.


  M +7 -7      kcharsets.cpp   1.145


--- kdelibs/kdecore/kcharsets.cpp  #1.144:1.145
@@ -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();
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic