webengine/osswebengine/WebKit/s60/misc/WebCharsetData.cpp
changeset 0 dd21522fd290
child 10 a359256acfc6
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "WebCharsetData.h"
       
    21 
       
    22 // EXTERNAL DATA STRUCTURES
       
    23 
       
    24 // EXTERNAL FUNCTION PROTOTYPES
       
    25 
       
    26 // CONSTANTS
       
    27 const TCharsetEntry supportedCharsetTable[] =
       
    28     {
       
    29     {KCharacterSetIdentifierIso88591,   _S("iso-8859-1") },
       
    30     {KCharacterSetIdentifierIso88591,   _S("iso-8859-1") },
       
    31     {KCharacterSetIdentifierIso88591,   _S("iso8859-1") },
       
    32     {0x101F873B,                        _S("windows-1252")},
       
    33     {KCharacterSetIdentifierUtf8,       _S("utf-8")},
       
    34     {KCharacterSetIdentifierGb2312,     _S("gb2312")},
       
    35     {KCharacterSetIdentifierBig5,       _S("big5")},
       
    36     {KCharacterSetIdentifierIso88592,   _S("iso-8859-2")},
       
    37     {KCharacterSetIdentifierIso88594,   _S("iso-8859-4")},
       
    38     {KCharacterSetIdentifierIso88595,   _S("iso-8859-5")},
       
    39     {KCharacterSetIdentifierIso88596,   _S("iso-8859-6")},
       
    40     {KCharacterSetIdentifierIso88597,   _S("iso-8859-7")},
       
    41     {KCharacterSetIdentifierIso88598,   _S("iso-8859-8")},
       
    42     {KCharacterSetIdentifierIso88599,   _S("iso-8859-9")},
       
    43     {KCharacterSetIdentifierIso885915,  _S("iso-8859-15")},
       
    44     {0x100059d6,                        _S("windows-1250")}, // no header file is provided with the converter windows-1250
       
    45     {0x100059D7,                        _S("windows-1251")}, // no header file is provided with the converter windows-1251
       
    46     {0x100059D8,                        _S("windows-1253")}, // no header file is provided with the converter windows-1253
       
    47     {0x100059D9,                        _S("windows-1254")}, // no header file is provided with the converter windows-1254
       
    48     {0x101F8547,                        _S("windows-1255")}, // no header file is provided with the converter windows-1255
       
    49     {0x101F8547,                        _S("iso-8859-8i")}, // no header file is provided with the converter windows-1255
       
    50     {0x101F8548,                        _S("windows-1256")}, // no header file is provided with the converter windows-1256
       
    51     {0x100059DA,                        _S("windows-1257")}, // no header file is provided with the converter windows-1257
       
    52     {0x102073B8,                        _S("windows-1258")}, // no header file is provided with the converter windows-1258
       
    53     {0x101F8549,                        _S("tis-620")}, // no header file is provided with the converter tis-620
       
    54     {KCharacterSetIdentifierShiftJis,   _S("shift_jis")},
       
    55     {KCharacterSetIdentifierShiftJis,   _S("shift-jis")},
       
    56     {KCharacterSetIdentifierShiftJis,   _S("x-sjis")},
       
    57     {KCharacterSetIdentifierJis,        _S("jis_x0201-1997")},
       
    58     {KCharacterSetIdentifierJis,        _S("jis_x0208-1997")},
       
    59     {KCharacterSetIdentifierEucJpPacked,_S("euc-jp")},
       
    60     {KCharacterSetIdentifierEucJpPacked,_S("x-euc-jp")},
       
    61     {KCharacterSetIdentifierIso2022Jp,  _S("iso-2022-jp")},
       
    62     {0x101F854A,                        _S("windows-874")}, // no header file is provided with the converter windows-874
       
    63     {0x101F8778,                        _S("koi8-r")}, // no header file is provided with the converter Russian
       
    64     {0x101F8761,                        _S("koi8-u")}, // no header file is provided with the converter Ukrainian
       
    65     {KCharacterSetIdentifierUcs2,       _S("iso-10646-ucs-2")},
       
    66     {KCharacterSetIdentifierUcs2,       _S("unicode")},
       
    67     {KCharacterSetIdentifierUnicodeBig, _S("ucs-2-big")},
       
    68     {KCharacterSetIdentifierUnicodeLittle,_S("ucs-2-little")},
       
    69     {0x1027508E,                        _S("iscii")},
       
    70     {0,                                 NULL}
       
    71 };
       
    72 
       
    73 // MACROS
       
    74 
       
    75 // LOCAL CONSTANTS AND MACROS
       
    76 
       
    77 // MODULE DATA STRUCTURES
       
    78 
       
    79 // LOCAL FUNCTION PROTOTYPES
       
    80 
       
    81 // FORWARD DECLARATIONS
       
    82 
       
    83 // ============================= LOCAL FUNCTIONS ===============================
       
    84 
       
    85 // ============================ MEMBER FUNCTIONS ===============================
       
    86 
       
    87 
       
    88 unsigned int uidForCharset(TText* charset) 
       
    89 {
       
    90     int i;
       
    91     int count = sizeof(supportedCharsetTable)/sizeof(TCharsetEntry);
       
    92     TPtrC charsetPtr(charset);
       
    93     for (i = 0; i < count; i++) {
       
    94         TPtrC supportedCharsetPtr(supportedCharsetTable[i].charsetName);
       
    95         if (charsetPtr.CompareF(supportedCharsetPtr) == 0) {
       
    96             break;
       
    97         }
       
    98     }
       
    99     if (i < count && supportedCharsetTable[i].charsetName != NULL) {
       
   100         return supportedCharsetTable[i].uid;
       
   101     }
       
   102     return 0;
       
   103 }
       
   104 
       
   105 
       
   106 
       
   107 const TText* charsetForUid(unsigned int uid)
       
   108 {
       
   109     int i;
       
   110     int count = sizeof(supportedCharsetTable)/sizeof(TCharsetEntry);
       
   111     for (i = 0; i < count; i++) {
       
   112         if (uid == supportedCharsetTable[i].uid) {
       
   113             break;
       
   114         }
       
   115     }
       
   116     if (i < count && supportedCharsetTable[i].charsetName != NULL) {
       
   117         return supportedCharsetTable[i].charsetName;
       
   118     }
       
   119     return NULL;
       
   120 }
       
   121 
       
   122 //  End of File