From ef6f2bf9098eff849290494f2da55c3b9ab0b95f Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@nokia.com>
Date: Wed, 15 Sep 2010 16:56:15 +0200
Subject: Maintaining codecsData in qtextcodec_symbian.cpp

Adding portuguese_gsm7_single, portuguese_locking_gsm7ext,
portuguese_locking_single, spanish_gsm7_single and GB18030.
This should reduce the amount of expensive calls to
CCnvCharacterSetConverter::
               ConvertCharacterSetIdentifierToStandardNameL()

Also adding an alias "Java UTF-8" to the existing "JAVA UTF-8"
since that is what the function with long name would return.

Task-Number: QTBUG-13565
Reviewed-By: Olivier Goffart
---
 src/corelib/codecs/qtextcodec_symbian.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp
index 20e0cfc..322c146 100644
--- a/src/corelib/codecs/qtextcodec_symbian.cpp
+++ b/src/corelib/codecs/qtextcodec_symbian.cpp
@@ -60,7 +60,7 @@ struct QSymbianCodecInitData {
  */
 static const QSymbianCodecInitData codecsData[] = {
     { /*268439485*/ KCharacterSetIdentifierShiftJis,            17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0MS_KANJI\0SJIS\0" },
-    { /*268439486*/ KCharacterSetIdentifierGb2312,              57, "GB2312\0csGB2312\0CN-GB\0EUC-CN\0" },
+    { /*268439486*/ KCharacterSetIdentifierGb2312,              57, "GB2312\0csGB2312\0CN-GB\0EUC-CN\0" },  // Note: ConvertCharacterSetIdentifierToMibEnumL returns Mib 0 instaead of 57
     { /*268439487*/ KCharacterSetIdentifierBig5,              2026, "Big5\0csBig5\0Big5-ETen\0CP950\0BIG-FIVE\0CN-BIG5\0" },
     { /*268440246*/ KCharacterSetIdentifierCodePage1252,      2252, "windows-1252\0Code Page 1252\0CP1252\0MS-ANSI\0" },
 //  { /*268450576*/ KCharacterSetIdentifierIso88591,             4, "ISO-8859-1\0ISO_8859-1:1987\0iso-ir-100\0ISO_8859-1\0latin1\0l1\0IBM819\0CP819\0csISOLatin1\0ISO-IR-100\0ISO8859-1\0L1\0LATIN1\0CSISOLATIN1\0" },
@@ -76,7 +76,7 @@ static const QSymbianCodecInitData codecsData[] = {
     { /*268458028*/ KCharacterSetIdentifierUtf7,               103, "UTF-7\0UNICODE-1-1-UTF-7\0CSUNICODE11UTF7\0" },
 //  { /*268458029*/ KCharacterSetIdentifierUtf8,               106, "UTF-8\0" },
     { /*268458030*/ KCharacterSetIdentifierImapUtf7,             0, "IMAP UTF-7\0" },
-    { /*268458031*/ KCharacterSetIdentifierJavaConformantUtf8,   0, "JAVA UTF-8\0" },
+    { /*268458031*/ KCharacterSetIdentifierJavaConformantUtf8,   0, "Java UTF-8\0JAVA UTF-8\0" },
     { /*268458454*/ 268458454,                                2250, "Windows-1250\0CP1250\0MS-EE\0" },
     { /*268458455*/ 268458455,                                2251, "Windows-1251\0CP1251\0MS-CYRL\0" },
     { /*268458456*/ 268458456,                                2253, "Windows-1253\0CP1253\0MS-GREEK\0" },
@@ -110,11 +110,16 @@ static const QSymbianCodecInitData codecsData[] = {
     { /*270562232*/ 270562232,                                2258, "Windows-1258\0CP1258\0WINDOWS-1258\0" },
     { /*270586888*/ 270586888,                                   0, "J5\0" },
     { /*271011982*/ 271011982,                                   0, "ISCII\0" },
-    { /*271066541*/ 271066541,                                2009, "CP850\0IBM850\0""850\0csPC850Multilingual\0" },
+    { /*271066541*/ 271066541,                                2009, "CP850\0IBM850\0""850\0csPC850Multilingual\0" }, // Note: ConvertCharacterSetIdentifierToMibEnumL returns Mib 0 instead of 2009
     { /*271082493*/ 271082493,                                   0, "EXTENDED_SMS_7BIT\0" },
     { /*271082494*/ 271082494,                                   0, "gsm7_turkish_single\0" },
     { /*271082495*/ 271082495,                                   0, "turkish_locking_gsm7ext\0" },
     { /*271082496*/ 271082496,                                   0, "turkish_locking_single\0" },
+    { /*271082503*/ 271082503,                                   0, "portuguese_gsm7_single\0" },                              
+    { /*271082504*/ 271082504,                                   0, "portuguese_locking_gsm7ext\0" },                          
+    { /*271082505*/ 271082505,                                   0, "portuguese_locking_single\0" },                           
+    { /*271082506*/ 271082506,                                   0, "spanish_gsm7_single\0" },                                 
+    { /*271085624*/ 271085624,                                 114, "GB18030\0" },                                             
     { /*536929574*/ 536929574,                                  38, "EUC-KR\0" },
     { /*536936703*/ 536936703,                                   0, "CP949\0" },
     { /*536936705*/ 536936705,                                  37, "ISO-2022-KR\0" },
@@ -659,6 +664,10 @@ QSymbianTextCodec *QSymbianTextCodec::init()
             if (charsetId == localeMapperId)
                 localeMapper = c;
         } else {
+            // We did not find the charsetId in our codecsData[], therefore we ask
+            // the OS for the codec name. We first try to get a "standard name" and fall
+            // back to array->At(i).Name(), if really needed. array->At(i).Name() is not
+            // guaranteed to be a correct name for QTextCodec::codecFromName(). 
             QScopedPointer<HBufC8> buf;
             QT_TRAP_THROWING(buf.reset(converter->ConvertCharacterSetIdentifierToStandardNameL(charsetId, qt_s60GetRFs())))
             QByteArray name;
-- 
cgit v0.12