.NET框架中这些项目的WinRT等价物是什么?
CultureInfo.CurrentCulture.LCID
Encoding.GetEncoding(int codePage)
Encoding.CodePage
答案 0 :(得分:1)
AFAIK LCID也在Silverlight中消失了,至少在Windows Phone上,如果你真的需要它 - 你必须从文档中抓取一个表,如here。
与编码相同 - 您需要将名称映射到代码页,例如使用here中的表格。
答案 1 :(得分:1)
在WinRT中不推荐使用LCID和代码页。 您应该从LCID迁移到使用语言名称。您应该从使用代码页编码迁移到Unicode编码(UTF-8,UTF-16)。
答案 2 :(得分:0)
这里是encodings supported by the .NET Framework:
的映射class CodePage
{
public static string GetEncodingString(int codePage)
{
string encodingString = null;
switch (codePage)
{
case 37:
encodingString = "IBM037"; // IBM EBCDIC (US-Canada)
break;
case 437:
encodingString = "IBM437"; // OEM United States
break;
case 500:
encodingString = "IBM500"; // IBM EBCDIC (International)
break;
case 708:
encodingString = "ASMO-708"; // Arabic (ASMO 708)
break;
case 720:
encodingString = "DOS-720"; // Arabic (DOS)
break;
case 737:
encodingString = "ibm737"; // Greek (DOS)
break;
case 775:
encodingString = "ibm775"; // Baltic (DOS)
break;
case 850:
encodingString = "ibm850"; // Western European (DOS)
break;
case 852:
encodingString = "ibm852"; // Central European (DOS)
break;
case 855:
encodingString = "IBM855"; // OEM Cyrillic
break;
case 857:
encodingString = "ibm857"; // Turkish (DOS)
break;
case 858:
encodingString = "IBM00858"; // OEM Multilingual Latin I
break;
case 860:
encodingString = "IBM860"; // Portuguese (DOS)
break;
case 861:
encodingString = "ibm861"; // Icelandic (DOS)
break;
case 862:
encodingString = "DOS-862"; // Hebrew (DOS)
break;
case 863:
encodingString = "IBM863"; // French Canadian (DOS)
break;
case 864:
encodingString = "IBM864"; // Arabic (864)
break;
case 865:
encodingString = "IBM865"; // Nordic (DOS)
break;
case 866:
encodingString = "cp866"; // Cyrillic (DOS)
break;
case 869:
encodingString = "ibm869"; // Greek, Modern (DOS)
break;
case 870:
encodingString = "IBM870"; // IBM EBCDIC (Multilingual Latin-2)
break;
case 874:
encodingString = "windows-874"; // Thai (Windows)
break;
case 875:
encodingString = "cp875"; // IBM EBCDIC (Greek Modern)
break;
case 932:
encodingString = "shift_jis"; // Japanese (Shift-JIS)
break;
case 936:
encodingString = "gb2312"; // Chinese Simplified (GB2312) *
break;
case 949:
encodingString = "ks_c_5601-1987"; // Korean
break;
case 950:
encodingString = "big5"; // Chinese Traditional (Big5)
break;
case 1026:
encodingString = "IBM1026"; // IBM EBCDIC (Turkish Latin-5)
break;
case 1047:
encodingString = "IBM01047"; // IBM Latin-1
break;
case 1140:
encodingString = "IBM01140"; // IBM EBCDIC (US-Canada-Euro)
break;
case 1141:
encodingString = "IBM01141"; // IBM EBCDIC (Germany-Euro)
break;
case 1142:
encodingString = "IBM01142"; // IBM EBCDIC (Denmark-Norway-Euro)
break;
case 1143:
encodingString = "IBM01143"; // IBM EBCDIC (Finland-Sweden-Euro)
break;
case 1144:
encodingString = "IBM01144"; // IBM EBCDIC (Italy-Euro)
break;
case 1145:
encodingString = "IBM01145"; // IBM EBCDIC (Spain-Euro)
break;
case 1146:
encodingString = "IBM01146"; // IBM EBCDIC (UK-Euro)
break;
case 1147:
encodingString = "IBM01147"; // IBM EBCDIC (France-Euro)
break;
case 1148:
encodingString = "IBM01148"; // IBM EBCDIC (International-Euro)
break;
case 1149:
encodingString = "IBM01149"; // IBM EBCDIC (Icelandic-Euro)
break;
case 1200:
encodingString = "utf-16"; // Unicode *
break;
case 1201:
encodingString = "unicodeFFFE"; // Unicode (Big endian) *
break;
case 1250:
encodingString = "windows-1250"; // Central European (Windows)
break;
case 1251:
encodingString = "windows-1251"; // Cyrillic (Windows)
break;
case 1252:
encodingString = "Windows-1252"; // Western European (Windows) *
break;
case 1253:
encodingString = "windows-1253"; // Greek (Windows)
break;
case 1254:
encodingString = "windows-1254"; // Turkish (Windows)
break;
case 1255:
encodingString = "windows-1255"; // Hebrew (Windows)
break;
case 1256:
encodingString = "windows-1256"; // Arabic (Windows)
break;
case 1257:
encodingString = "windows-1257"; // Baltic (Windows)
break;
case 1258:
encodingString = "windows-1258"; // Vietnamese (Windows)
break;
case 1361:
encodingString = "Johab"; // Korean (Johab)
break;
case 10000:
encodingString = "macintosh"; // Western European (Mac)
break;
case 10001:
encodingString = "x-mac-japanese"; // Japanese (Mac)
break;
case 10002:
encodingString = "x-mac-chinesetrad"; // Chinese Traditional (Mac)
break;
case 10003:
encodingString = "x-mac-korean"; // Korean (Mac) *
break;
case 10004:
encodingString = "x-mac-arabic"; // Arabic (Mac)
break;
case 10005:
encodingString = "x-mac-hebrew"; // Hebrew (Mac)
break;
case 10006:
encodingString = "x-mac-greek"; // Greek (Mac)
break;
case 10007:
encodingString = "x-mac-cyrillic"; // Cyrillic (Mac)
break;
case 10008:
encodingString = "x-mac-chinesesimp"; // Chinese Simplified (Mac) *
break;
case 10010:
encodingString = "x-mac-romanian"; // Romanian (Mac)
break;
case 10017:
encodingString = "x-mac-ukrainian"; // Ukrainian (Mac)
break;
case 10021:
encodingString = "x-mac-thai"; // Thai (Mac)
break;
case 10029:
encodingString = "x-mac-ce"; // Central European (Mac)
break;
case 10079:
encodingString = "x-mac-icelandic"; // Icelandic (Mac)
break;
case 10081:
encodingString = "x-mac-turkish"; // Turkish (Mac)
break;
case 10082:
encodingString = "x-mac-croatian"; // Croatian (Mac)
break;
case 12000:
encodingString = "utf-32"; // Unicode (UTF-32) *
break;
case 12001:
encodingString = "utf-32BE"; // Unicode (UTF-32 Big endian) *
break;
case 20000:
encodingString = "x-Chinese-CNS"; // Chinese Traditional (CNS)
break;
case 20001:
encodingString = "x-cp20001"; // TCA Taiwan
break;
case 20002:
encodingString = "x-Chinese-Eten"; // Chinese Traditional (Eten)
break;
case 20003:
encodingString = "x-cp20003"; // IBM5550 Taiwan
break;
case 20004:
encodingString = "x-cp20004"; // TeleText Taiwan
break;
case 20005:
encodingString = "x-cp20005"; // Wang Taiwan
break;
case 20105:
encodingString = "x-IA5"; // Western European (IA5)
break;
case 20106:
encodingString = "x-IA5-German"; // German (IA5)
break;
case 20107:
encodingString = "x-IA5-Swedish"; // Swedish (IA5)
break;
case 20108:
encodingString = "x-IA5-Norwegian"; // Norwegian (IA5)
break;
case 20127:
encodingString = "us-ascii"; // US-ASCII *
break;
case 20261:
encodingString = "x-cp20261"; // T.61
break;
case 20269:
encodingString = "x-cp20269"; // ISO-6937
break;
case 20273:
encodingString = "IBM273"; // IBM EBCDIC (Germany)
break;
case 20277:
encodingString = "IBM277"; // IBM EBCDIC (Denmark-Norway)
break;
case 20278:
encodingString = "IBM278"; // IBM EBCDIC (Finland-Sweden)
break;
case 20280:
encodingString = "IBM280"; // IBM EBCDIC (Italy)
break;
case 20284:
encodingString = "IBM284"; // IBM EBCDIC (Spain)
break;
case 20285:
encodingString = "IBM285"; // IBM EBCDIC (UK)
break;
case 20290:
encodingString = "IBM290"; // IBM EBCDIC (Japanese katakana)
break;
case 20297:
encodingString = "IBM297"; // IBM EBCDIC (France)
break;
case 20420:
encodingString = "IBM420"; // IBM EBCDIC (Arabic)
break;
case 20423:
encodingString = "IBM423"; // IBM EBCDIC (Greek)
break;
case 20424:
encodingString = "IBM424"; // IBM EBCDIC (Hebrew)
break;
case 20833:
encodingString = "x-EBCDIC-KoreanExtended"; // IBM EBCDIC (Korean Extended)
break;
case 20838:
encodingString = "IBM-Thai"; // IBM EBCDIC (Thai)
break;
case 20866:
encodingString = "koi8-r"; // Cyrillic (KOI8-R)
break;
case 20871:
encodingString = "IBM871"; // IBM EBCDIC (Icelandic)
break;
case 20880:
encodingString = "IBM880"; // IBM EBCDIC (Cyrillic Russian)
break;
case 20905:
encodingString = "IBM905"; // IBM EBCDIC (Turkish)
break;
case 20924:
encodingString = "IBM00924"; // IBM Latin-1
break;
case 20932:
encodingString = "EUC-JP"; // Japanese (JIS 0208-1990 and 0212-1990)
break;
case 20936:
encodingString = "x-cp20936"; // Chinese Simplified (GB2312-80) *
break;
case 20949:
encodingString = "x-cp20949"; // Korean Wansung *
break;
case 21025:
encodingString = "cp1025"; // IBM EBCDIC (Cyrillic Serbian-Bulgarian)
break;
case 21866:
encodingString = "koi8-u"; // Cyrillic (KOI8-U)
break;
case 28591:
encodingString = "iso-8859-1"; // Western European (ISO) *
break;
case 28592:
encodingString = "iso-8859-2"; // Central European (ISO)
break;
case 28593:
encodingString = "iso-8859-3"; // Latin 3 (ISO)
break;
case 28594:
encodingString = "iso-8859-4"; // Baltic (ISO)
break;
case 28595:
encodingString = "iso-8859-5"; // Cyrillic (ISO)
break;
case 28596:
encodingString = "iso-8859-6"; // Arabic (ISO)
break;
case 28597:
encodingString = "iso-8859-7"; // Greek (ISO)
break;
case 28598:
encodingString = "iso-8859-8"; // Hebrew (ISO-Visual) *
break;
case 28599:
encodingString = "iso-8859-9"; // Turkish (ISO)
break;
case 28603:
encodingString = "iso-8859-13"; // Estonian (ISO)
break;
case 28605:
encodingString = "iso-8859-15"; // Latin 9 (ISO)
break;
case 29001:
encodingString = "x-Europa"; // Europa
break;
case 38598:
encodingString = "iso-8859-8-i"; // Hebrew (ISO-Logical) *
break;
case 50220:
encodingString = "iso-2022-jp"; // Japanese (JIS) *
break;
case 50221:
encodingString = "csISO2022JP"; // Japanese (JIS-Allow 1 byte Kana) *
break;
case 50222:
encodingString = "iso-2022-jp"; // Japanese (JIS-Allow 1 byte Kana - SO/SI) *
break;
case 50225:
encodingString = "iso-2022-kr"; // Korean (ISO) *
break;
case 50227:
encodingString = "x-cp50227"; // Chinese Simplified (ISO-2022) *
break;
case 51932:
encodingString = "euc-jp"; // Japanese (EUC) *
break;
case 51936:
encodingString = "EUC-CN"; // Chinese Simplified (EUC) *
break;
case 51949:
encodingString = "euc-kr"; // Korean (EUC) *
break;
case 52936:
encodingString = "hz-gb-2312"; // Chinese Simplified (HZ) *
break;
case 54936:
encodingString = "GB18030"; // Chinese Simplified (GB18030) *
break;
case 57002:
encodingString = "x-iscii-de"; // ISCII Devanagari *
break;
case 57003:
encodingString = "x-iscii-be"; // ISCII Bengali *
break;
case 57004:
encodingString = "x-iscii-ta"; // ISCII Tamil *
break;
case 57005:
encodingString = "x-iscii-te"; // ISCII Telugu *
break;
case 57006:
encodingString = "x-iscii-as"; // ISCII Assamese *
break;
case 57007:
encodingString = "x-iscii-or"; // ISCII Oriya *
break;
case 57008:
encodingString = "x-iscii-ka"; // ISCII Kannada *
break;
case 57009:
encodingString = "x-iscii-ma"; // ISCII Malayalam *
break;
case 57010:
encodingString = "x-iscii-gu"; // ISCII Gujarati *
break;
case 57011:
encodingString = "x-iscii-pa"; // ISCII Punjabi *
break;
case 65000:
encodingString = "utf-7"; // Unicode (UTF-7) *
break;
case 65001:
encodingString = "utf-8"; // Unicode (UTF-8) *
break;
}
return encodingString;
}
}