1 // 2 // VMime library (http://www.vmime.org) 3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org> 4 // 5 // This program is free software; you can redistribute it and/or 6 // modify it under the terms of the GNU General Public License as 7 // published by the Free Software Foundation; either version 3 of 8 // the License, or (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License along 16 // with this program; if not, write to the Free Software Foundation, Inc., 17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 // 19 // Linking this library statically or dynamically with other modules is making 20 // a combined work based on this library. Thus, the terms and conditions of 21 // the GNU General Public License cover the whole combination. 22 // 23 24 #ifndef VMIME_PLATFORMS_WINDOWS_CODEPAGES_HPP_INCLUDED 25 #define VMIME_PLATFORMS_WINDOWS_CODEPAGES_HPP_INCLUDED 26 27 28 #include "vmime/config.hpp" 29 30 31 #if VMIME_PLATFORM_IS_WINDOWS 32 33 34 #include <string.h> 35 36 37 namespace vmime { 38 namespace platforms { 39 namespace windows { 40 41 42 class windowsCodepages 43 { 44 public: 45 getByName(const char * s8_Name)46 static int getByName(const char* s8_Name) 47 { 48 if (stricmp(s8_Name, "ASMO-708") == 0) return 708; 49 if (stricmp(s8_Name, "big5") == 0) return 950; 50 if (stricmp(s8_Name, "cp1025") == 0) return 21025; 51 if (stricmp(s8_Name, "cp866") == 0) return 866; 52 if (stricmp(s8_Name, "cp875") == 0) return 875; 53 if (stricmp(s8_Name, "DOS-720") == 0) return 720; 54 if (stricmp(s8_Name, "DOS-862") == 0) return 862; 55 if (stricmp(s8_Name, "EUC-CN") == 0) return 51936; 56 if (stricmp(s8_Name, "euc-jp") == 0) return 51932; 57 if (stricmp(s8_Name, "EUC-JP") == 0) return 20932; 58 if (stricmp(s8_Name, "euc-kr") == 0) return 51949; 59 if (stricmp(s8_Name, "GB18030") == 0) return 54936; 60 if (stricmp(s8_Name, "GBK") == 0) return 54936; 61 if (stricmp(s8_Name, "gb2312") == 0) return 936; 62 if (stricmp(s8_Name, "hz-gb-2312") == 0) return 52936; 63 if (stricmp(s8_Name, "IBM00858") == 0) return 858; 64 if (stricmp(s8_Name, "IBM00924") == 0) return 20924; 65 if (stricmp(s8_Name, "IBM01047") == 0) return 1047; 66 if (stricmp(s8_Name, "IBM01140") == 0) return 1140; 67 if (stricmp(s8_Name, "IBM01141") == 0) return 1141; 68 if (stricmp(s8_Name, "IBM01142") == 0) return 1142; 69 if (stricmp(s8_Name, "IBM01143") == 0) return 1143; 70 if (stricmp(s8_Name, "IBM01144") == 0) return 1144; 71 if (stricmp(s8_Name, "IBM01145") == 0) return 1145; 72 if (stricmp(s8_Name, "IBM01146") == 0) return 1146; 73 if (stricmp(s8_Name, "IBM01147") == 0) return 1147; 74 if (stricmp(s8_Name, "IBM01148") == 0) return 1148; 75 if (stricmp(s8_Name, "IBM01149") == 0) return 1149; 76 if (stricmp(s8_Name, "IBM037") == 0) return 37; 77 if (stricmp(s8_Name, "IBM1026") == 0) return 1026; 78 if (stricmp(s8_Name, "IBM273") == 0) return 20273; 79 if (stricmp(s8_Name, "IBM277") == 0) return 20277; 80 if (stricmp(s8_Name, "IBM278") == 0) return 20278; 81 if (stricmp(s8_Name, "IBM280") == 0) return 20280; 82 if (stricmp(s8_Name, "IBM284") == 0) return 20284; 83 if (stricmp(s8_Name, "IBM285") == 0) return 20285; 84 if (stricmp(s8_Name, "IBM290") == 0) return 20290; 85 if (stricmp(s8_Name, "IBM297") == 0) return 20297; 86 if (stricmp(s8_Name, "IBM420") == 0) return 20420; 87 if (stricmp(s8_Name, "IBM423") == 0) return 20423; 88 if (stricmp(s8_Name, "IBM424") == 0) return 20424; 89 if (stricmp(s8_Name, "IBM437") == 0) return 437; 90 if (stricmp(s8_Name, "IBM500") == 0) return 500; 91 if (stricmp(s8_Name, "ibm737") == 0) return 737; 92 if (stricmp(s8_Name, "ibm775") == 0) return 775; 93 if (stricmp(s8_Name, "ibm850") == 0) return 850; 94 if (stricmp(s8_Name, "ibm852") == 0) return 852; 95 if (stricmp(s8_Name, "IBM855") == 0) return 855; 96 if (stricmp(s8_Name, "ibm857") == 0) return 857; 97 if (stricmp(s8_Name, "IBM860") == 0) return 860; 98 if (stricmp(s8_Name, "ibm861") == 0) return 861; 99 if (stricmp(s8_Name, "IBM863") == 0) return 863; 100 if (stricmp(s8_Name, "IBM864") == 0) return 864; 101 if (stricmp(s8_Name, "IBM865") == 0) return 865; 102 if (stricmp(s8_Name, "ibm869") == 0) return 869; 103 if (stricmp(s8_Name, "IBM870") == 0) return 870; 104 if (stricmp(s8_Name, "IBM871") == 0) return 20871; 105 if (stricmp(s8_Name, "IBM880") == 0) return 20880; 106 if (stricmp(s8_Name, "IBM905") == 0) return 20905; 107 if (stricmp(s8_Name, "IBM-Thai") == 0) return 20838; 108 if (stricmp(s8_Name, "iso-2022-jp") == 0) return 50222; 109 if (stricmp(s8_Name, "iso-2022-kr") == 0) return 50225; 110 if (stricmp(s8_Name, "iso-8859-1") == 0) return 28591; 111 if (stricmp(s8_Name, "iso-8859-13") == 0) return 28603; 112 if (stricmp(s8_Name, "iso-8859-15") == 0) return 28605; 113 if (stricmp(s8_Name, "iso-8859-2") == 0) return 28592; 114 if (stricmp(s8_Name, "iso-8859-3") == 0) return 28593; 115 if (stricmp(s8_Name, "iso-8859-4") == 0) return 28594; 116 if (stricmp(s8_Name, "iso-8859-5") == 0) return 28595; 117 if (stricmp(s8_Name, "iso-8859-6") == 0) return 28596; 118 if (stricmp(s8_Name, "iso-8859-7") == 0) return 28597; 119 if (stricmp(s8_Name, "iso-8859-8") == 0) return 28598; 120 if (stricmp(s8_Name, "iso-8859-8-i") == 0) return 38598; 121 if (stricmp(s8_Name, "iso-8859-9") == 0) return 28599; 122 if (stricmp(s8_Name, "Johab") == 0) return 1361; 123 if (stricmp(s8_Name, "koi8-r") == 0) return 20866; 124 if (stricmp(s8_Name, "koi8-u") == 0) return 21866; 125 if (stricmp(s8_Name, "ks_c_5601-1987") == 0) return 949; 126 if (stricmp(s8_Name, "macintosh") == 0) return 10000; 127 if (stricmp(s8_Name, "unicodeFFFE") == 0) return 1201; 128 if (stricmp(s8_Name, "us-ascii") == 0) return 20127; 129 if (stricmp(s8_Name, "utf-16") == 0) return 1200; 130 if (stricmp(s8_Name, "utf-32") == 0) return 12000; 131 if (stricmp(s8_Name, "utf-32BE") == 0) return 12001; 132 if (stricmp(s8_Name, "utf-7") == 0) return 65000; 133 if (stricmp(s8_Name, "utf-8") == 0) return 65001; 134 if (stricmp(s8_Name, "windows-1250") == 0) return 1250; 135 if (stricmp(s8_Name, "windows-1251") == 0) return 1251; 136 if (stricmp(s8_Name, "Windows-1252") == 0) return 1252; 137 if (stricmp(s8_Name, "windows-1253") == 0) return 1253; 138 if (stricmp(s8_Name, "windows-1254") == 0) return 1254; 139 if (stricmp(s8_Name, "windows-1255") == 0) return 1255; 140 if (stricmp(s8_Name, "windows-1256") == 0) return 1256; 141 if (stricmp(s8_Name, "windows-1257") == 0) return 1257; 142 if (stricmp(s8_Name, "windows-1258") == 0) return 1258; 143 if (stricmp(s8_Name, "windows-874") == 0) return 874; 144 if (stricmp(s8_Name, "x-Chinese-CNS") == 0) return 20000; 145 if (stricmp(s8_Name, "x-Chinese-Eten") == 0) return 20002; 146 if (stricmp(s8_Name, "x-cp20001") == 0) return 20001; 147 if (stricmp(s8_Name, "x-cp20003") == 0) return 20003; 148 if (stricmp(s8_Name, "x-cp20004") == 0) return 20004; 149 if (stricmp(s8_Name, "x-cp20005") == 0) return 20005; 150 if (stricmp(s8_Name, "x-cp20261") == 0) return 20261; 151 if (stricmp(s8_Name, "x-cp20269") == 0) return 20269; 152 if (stricmp(s8_Name, "x-cp20936") == 0) return 20936; 153 if (stricmp(s8_Name, "x-cp20949") == 0) return 20949; 154 if (stricmp(s8_Name, "x-cp50227") == 0) return 50227; 155 if (stricmp(s8_Name, "x-EBCDIC-KoreanExtended") == 0) return 20833; 156 if (stricmp(s8_Name, "x-Europa") == 0) return 29001; 157 if (stricmp(s8_Name, "x-IA5") == 0) return 20105; 158 if (stricmp(s8_Name, "x-IA5-German") == 0) return 20106; 159 if (stricmp(s8_Name, "x-IA5-Norwegian") == 0) return 20108; 160 if (stricmp(s8_Name, "x-IA5-Swedish") == 0) return 20107; 161 if (stricmp(s8_Name, "x-iscii-as") == 0) return 57006; 162 if (stricmp(s8_Name, "x-iscii-be") == 0) return 57003; 163 if (stricmp(s8_Name, "x-iscii-de") == 0) return 57002; 164 if (stricmp(s8_Name, "x-iscii-gu") == 0) return 57010; 165 if (stricmp(s8_Name, "x-iscii-ka") == 0) return 57008; 166 if (stricmp(s8_Name, "x-iscii-ma") == 0) return 57009; 167 if (stricmp(s8_Name, "x-iscii-or") == 0) return 57007; 168 if (stricmp(s8_Name, "x-iscii-pa") == 0) return 57011; 169 if (stricmp(s8_Name, "x-iscii-ta") == 0) return 57004; 170 if (stricmp(s8_Name, "x-iscii-te") == 0) return 57005; 171 if (stricmp(s8_Name, "x-mac-arabic") == 0) return 10004; 172 if (stricmp(s8_Name, "x-mac-ce") == 0) return 10029; 173 if (stricmp(s8_Name, "x-mac-chinesesimp") == 0) return 10008; 174 if (stricmp(s8_Name, "x-mac-chinesetrad") == 0) return 10002; 175 if (stricmp(s8_Name, "x-mac-croatian") == 0) return 10082; 176 if (stricmp(s8_Name, "x-mac-cyrillic") == 0) return 10007; 177 if (stricmp(s8_Name, "x-mac-greek") == 0) return 10006; 178 if (stricmp(s8_Name, "x-mac-hebrew") == 0) return 10005; 179 if (stricmp(s8_Name, "x-mac-icelandic") == 0) return 10079; 180 if (stricmp(s8_Name, "x-mac-japanese") == 0) return 10001; 181 if (stricmp(s8_Name, "x-mac-korean") == 0) return 10003; 182 if (stricmp(s8_Name, "x-mac-romanian") == 0) return 10010; 183 if (stricmp(s8_Name, "x-mac-thai") == 0) return 10021; 184 if (stricmp(s8_Name, "x-mac-turkish") == 0) return 10081; 185 if (stricmp(s8_Name, "x-mac-ukrainian") == 0) return 10017; 186 187 throw exception(std::string("Unknown charset: ") + s8_Name); 188 } 189 }; 190 191 192 } // windows 193 } // platforms 194 } // vmime 195 196 197 #endif // VMIME_PLATFORM_IS_WINDOWS 198 199 #endif // VMIME_PLATFORMS_WINDOWS_CODEPAGES_HPP_INCLUDED 200