check in vietnamese cp1258 XP patch from Van Le

This commit is contained in:
ftang%netscape.com 1998-09-30 10:31:32 +00:00
Родитель 8925b31b03
Коммит 6c43ad1272
4 изменённых файлов: 634 добавлений и 1156 удалений

Просмотреть файл

@ -1,348 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* csnametb.c */
#include "intlpriv.h"
/* Charset names and aliases from RFC 1700. Also encloded equivelend Java encoding names. Names are case
* insenstive. Currently searches table linearly, so keep commonly used names at the beginning.
*/
MODULE_PRIVATE csname2id_t csname2id_tbl[] = {
/* default if not specified */
{"x-default", "", CS_DEFAULT}, /* or unknown charset */
{"us-ascii", "8859_1", CS_ASCII},
{"iso-8859-1", "8859_1", CS_LATIN1},
{"iso-2022-jp", "JIS", CS_JIS},
{"iso-2022-jp-2", "JIS", CS_JIS}, /* treat same as iso-2022-jp*/
{"Shift_JIS", "SJIS", CS_SJIS},
{"euc-jp", "EUC", CS_EUCJP},
{"jis_x0208-1983", "JIS0208", CS_JISX0208},
{"x-jisx0208-11", "JIS0208", CS_JISX0208_11},
{"jis_x0201", "JIS0208", CS_JISX0201},
{"jis_x0212-1990", "JIS0208", CS_JISX0212},
{"x-mac-roman", "MacRoman", CS_MAC_ROMAN},
{"iso-8859-2", "8859_2", CS_LATIN2},
{"iso-8859-3", "8859_3", CS_8859_3},
{"iso-8859-4", "8859_4", CS_8859_4},
{"iso-8859-5", "8859_5", CS_8859_5},
{"iso-8859-6", "8859_6", CS_8859_6},
{"iso-8859-7", "8859_7", CS_8859_7},
{"iso-8859-8", "8859_8", CS_8859_8},
{"iso-8859-9", "8859_9", CS_8859_9},
{"x-mac-ce", "MacCentralEurope", CS_MAC_CE},
{"EUC-KR", "KSC5601", CS_KSC_8BIT}, /* change to UPPER case per Jungshik Shin <jshin@pantheon.yale.edu> request to work around Korean SendMail Decode bug */
{"ks_c_5601-1987", "KSC5601", CS_KSC5601},
{"x-ksc5601-11", "KSC5601", CS_KSC5601_11},
{"gb2312", "GB2312", CS_GB_8BIT},
{"gb_2312-80", "GB2312", CS_GB2312},
{"x-gb2312-11", "GB2312", CS_GB2312_11},
{"x-euc-tw", "", CS_CNS_8BIT},
{"x-cns11643-1", "CNS11643", CS_CNS11643_1},
{"x-cns11643-2", "CNS11643", CS_CNS11643_2},
{"x-cns11643-1110", "CNS11643", CS_CNS11643_1110},
{"iso-2022-kr", "KR2022", CS_2022_KR},
{"big5", "Big5", CS_BIG5},
{"x-x-big5", "Big5", CS_X_BIG5},
{"tis-620", "TIS620", CS_TIS620},
{"adobe-symbol-encoding", "Symbol", CS_SYMBOL},
{"x-dingbats", "DingBats", CS_DINGBATS},
{"x-dectech", "DECTECH", CS_DECTECH},
{"koi8-r", "KOI8", CS_KOI8_R},
{"x-mac-cyrillic", "MacCyrillic", CS_MAC_CYRILLIC},
{"x-mac-greek", "MacGreek", CS_MAC_GREEK},
{"x-mac-turkish", "MacTurkish", CS_MAC_TURKISH},
{"windows-1250", "Cp1250", CS_CP_1250},
{"windows-1251", "Cp1251", CS_CP_1251}, /* cyrillic */
{"windows-1253", "Cp1253", CS_CP_1253}, /* greek */
{"UTF-8", "UTF8", CS_UTF8},
{"UTF-7", "UTF7", CS_UTF7},
{"ISO-10646-UCS-2", "UCS2", CS_UCS2},
{"ISO-10646-UCS-4", "UCS4", CS_UCS4},
{"x-imap4-modified-utf7", "", CS_IMAP4_UTF7},
{"armscii-8", "", CS_ARMSCII8},
{"HZ-GB-2312", "", CS_HZ},
{"ISO-2022-CN", "", CS_ISO_2022_CN},
{"x-gb13000", "", CS_GB13000},
{"x-big5-plus", "", CS_BIG5_PLUS},
{"x-UHC", "", CS_UHC }, /* cp 949 */
{"x-cns11643-3", "", CS_CNS11643_3},
{"x-cns11643-4", "", CS_CNS11643_4},
{"x-cns11643-5", "", CS_CNS11643_5},
{"x-cns11643-6", "", CS_CNS11643_6},
{"x-cns11643-7", "", CS_CNS11643_7},
{"x-cns11643-8", "", CS_CNS11643_8},
{"x-cns11643-9", "", CS_CNS11643_9},
{"x-cns11643-10", "", CS_CNS11643_10},
{"x-cns11643-11", "", CS_CNS11643_11},
{"x-cns11643-12", "", CS_CNS11643_12},
{"x-cns11643-13", "", CS_CNS11643_13},
{"x-cns11643-14", "", CS_CNS11643_14},
{"x-cns11643-15", "", CS_CNS11643_15},
{"x-cns11643-16", "", CS_CNS11643_16},
{"VISCII", "", CS_VIET_VISCII},
{"VIQR", "", CS_VIET_VIQR},
{"koi8-u", "", CS_KOI8_U},
{"iso-ir-111", "", CS_ISO_IR_111},
{"iso_8859-6-e", "", CS_8859_6_E},
{"iso_8859-6-i", "", CS_8859_6_I},
{"iso_8859-8-e", "", CS_8859_8_E},
{"iso_8859-8-i", "", CS_8859_8_I},
{"x-johab", "", CS_JOHAB}, /* CP 1361 */
{"x-johabfont", "", CS_JOHABFONT}, /* hangterm johab font */
{"x-viet-vps", "", CS_VIET_VPS},
{"x-viet-tcvn", "", CS_VIET_TCVN},
{"x-viet-vni", "", CS_VIET_VNI},
{"T.61-8bit", "", CS_T61},
/* Additional OS/2 codepages. These are IANA primary names */
{"ibm850", "Cp850", CS_CP_850}, /* PC Latin 1 */
{"ibm852", "Cp852", CS_CP_852}, /* PC Latin 2 */
{"ibm855", "Cp855", CS_CP_855}, /* PC Cyrillic */
{"ibm857", "Cp857", CS_CP_857}, /* PC Turkish */
{"ibm862", "Cp862", CS_CP_862}, /* PC Hebrew */
{"ibm864", "Cp864", CS_CP_864}, /* PC Arabic */
{"ibm866", "Cp866", CS_CP_866}, /* PC Russian */
{"ibm874", "Cp874", CS_CP_874}, /* PC Thai */
{"windows-1257", "Cp1257", CS_CP_1257}, /* Windows Baltic */
/* OS/2 IANA alias entries */
{"cp850", "", CS_CP_850}, /* PC Latin 1 */
{"cp852", "", CS_CP_852}, /* PC Latin 2 */
{"cp857", "", CS_CP_857}, /* PC Turkish */
{"cp862", "", CS_CP_862}, /* PC Hebrew */
{"cp864", "", CS_CP_864}, /* PC Arabic */
{"cp874", "", CS_CP_874}, /* PC Thai */
/* aliases for us-ascii: */
{"ansi_x3.4-1968", "", CS_ASCII},
{"iso-ir-6", "", CS_ASCII},
{"ansi_x3.4-1986", "", CS_ASCII},
{"iso_646.irv:1991", "", CS_ASCII},
{"ascii", "", CS_ASCII},
{"iso646-us", "", CS_ASCII},
{"us", "", CS_ASCII},
{"ibm367", "", CS_ASCII},
{"cp367", "", CS_ASCII},
{"csASCII", "", CS_ASCII},
/* aliases for iso_8859-1: */
{"latin1", "", CS_LATIN1},
{"iso_8859-1", "", CS_LATIN1},
{"iso_8859-1:1987", "", CS_LATIN1},
{"iso-ir-100", "", CS_LATIN1},
{"l1", "", CS_LATIN1},
{"ibm819", "", CS_LATIN1},
{"cp819", "", CS_LATIN1},
{"ISO-8859-1-Windows-3.0-Latin-1", "", CS_LATIN1},
{"ISO-8859-1-Windows-3.1-Latin-1", "", CS_LATIN1},
{"windows-1252", "Cp1252", CS_LATIN1},
/* aliases for ISO_8859-2: */
{"latin2", "", CS_LATIN2},
{"iso_8859-2", "", CS_LATIN2},
{"iso_8859-2:1987", "", CS_LATIN2},
{"iso-ir-101", "", CS_LATIN2},
{"l2", "", CS_LATIN2},
{"ISO-8859-2-Windows-Latin-2", "", CS_LATIN2},
/* aliases for KS_C_5601-1987: */
{"ks_c_5601-1987", "", CS_KSC5601},
{"iso-ir-149", "", CS_KSC5601},
{"ks_c_5601-1989", "", CS_KSC5601},
{"ksc_5601", "", CS_KSC5601},
{"ks_c_5601", "", CS_KSC5601},
{"korean", "", CS_KSC5601},
{"csKSC56011987", "", CS_KSC5601},
/* aliases for iso-2022-kr: */
{"csISO2022KR", "", CS_2022_KR},
/* aliases for euc-kr: */
{"csEUCKR", "", CS_KSC_8BIT},
/* aliases for iso-2022-jp: */
{"csISO2022JP", "", CS_JIS},
/* aliases for iso-2022-jp-2: */
{"csISO2022JP2", "", CS_JIS},
/* aliases for GB_2312-80: */
{"iso-ir-58", "", CS_GB2312},
{"chinese", "", CS_GB2312},
{"csISO58GB231280", "", CS_GB2312},
/* aliases for gb2312: */
{"csGB2312", "", CS_GB_8BIT},
{"CN-GB", "", CS_GB_8BIT}, /* Simplified Chinese */
{"CN-GB-ISOIR165", "", CS_GB_8BIT}, /* Simplified Chinese */
/* aliases for big5: */
{"csBig5", "", CS_BIG5},
{"CN-Big5", "", CS_BIG5}, /* Traditional Chinese */
/* aliases for iso-8859-7: */
{"iso-ir-126", "", CS_8859_7},
{"iso_8859-7", "", CS_8859_7},
{"iso_8859-7:1987", "", CS_8859_7},
{"elot_928", "", CS_8859_7},
{"ecma-118", "", CS_8859_7},
{"greek", "", CS_8859_7},
{"greek8", "", CS_8859_7},
{"csISOLatinGreek", "", CS_8859_7},
/* aliases for iso-8859-5: */
{"iso-ir-144", "", CS_8859_5},
{"iso_8859-5", "", CS_8859_5},
{"iso_8859-5:1988", "", CS_8859_5},
{"cyrillic", "", CS_8859_5},
{"csISOLatinCyrillic", "", CS_8859_5},
/* aliases for jis_x0212-1990: */
{"x0212", "", CS_JISX0212},
{"iso-ir-159", "", CS_JISX0212},
{"csISO159JISX02121990", "", CS_JISX0212},
/* aliases for jis_x0201: */
{"x0201", "", CS_JISX0201},
{"csHalfWidthKatakana", "", CS_JISX0201},
/* aliases for koi8-r: */
{"csKOI8R", "", CS_KOI8_R},
/* aliases for koi8-u: */
{"koi8-ru", "", CS_KOI8_U},
/* aliases for Shift_JIS: */
{"x-sjis", "", CS_SJIS},
{"ms_Kanji", "", CS_SJIS},
{"csShiftJIS", "", CS_SJIS},
{"Windows-31J", "", CS_SJIS},
/* aliases for x-euc-jp: */
{"Extended_UNIX_Code_Packed_Format_for_Japanese", "", CS_EUCJP},
{"csEUCPkdFmtJapanese", "", CS_EUCJP},
{"x-euc-jp", "", CS_EUCJP},
/* aliases for adobe-symbol-encoding: */
{"csHPPSMath", "", CS_SYMBOL},
/* aliases for iso-8859-5-windows-latin-5: */
{"csWindows31Latin5", "", CS_CP_1251},
{"iso-8859-5-windows-latin-5", "", CS_CP_1251},
{"x-cp1251", "", CS_CP_1251},
/* aliases for windows-1250: */
{"x-cp1250", "", CS_CP_1250},
/* aliases for windows-1253: */
{"x-cp1253", "", CS_CP_1253},
/* aliases for windows-1254: */
{"windows-1254", "", CS_8859_9}, /* turkish */
/* aliases for UNICODE-1-1: */
{"csUnicode", "", CS_UCS2},
{"csUnicode11", "", CS_UCS2},
{"ISO-10646-UCS-BASIC", "", CS_UCS2},
{"csUnicodeASCII", "", CS_UCS2},
{"ISO-10646-Unicode-Latin1", "", CS_UCS2},
{"csUnicodeLatin1", "", CS_UCS2},
{"ISO-10646", "", CS_UCS2},
{"ISO-10646-J-1", "", CS_UCS2},
/* aliases for UNICODE-1-1-UTF-7: */
{"x-UNICODE-2-0-UTF-7", "", CS_UTF7}, /* This is not in INAN */
{"UNICODE-1-1-UTF-7", "", CS_UTF7},
{"UNICODE-2-0-UTF-7", "", CS_UTF7}, /* Appeared in UTF-7 RFC Draft */
{"csUnicode11UTF7", "", CS_UTF7},
/* aliases for UNICODE-1-1-UTF-8: */
{"UNICODE-1-1-UTF-8", "", CS_UTF8},
{"x-user-defined", "", CS_USER_DEFINED_ENCODING},
{"x-user-defined", "", CS_USRDEF2},
{"RESERVED", "", CS_DEFAULT}, /* or unknown charset */
/* aliases for VISCII: */
{"csVISCII", "", CS_VIET_VISCII},
/* aliases for VIQR: */
{"csVIQR", "", CS_VIET_VIQR},
/* aliases for ISO-8859-4: */
{"ISO_8859-4:1988", "", CS_8859_4},
{"iso-ir-110", "", CS_8859_4},
{"ISO_8859-4", "", CS_8859_4},
{"latin4", "", CS_8859_4},
{"l4", "", CS_8859_4},
{"csISOLatin4", "", CS_8859_4},
/* aliases for ISO-8859-9: */
{"ISO_8859-9:1989", "", CS_8859_9},
{"iso-ir-148", "", CS_8859_9},
{"ISO_8859-9", "", CS_8859_9},
{"latin5", "", CS_8859_9},
{"l5", "", CS_8859_9},
{"csISOLatin5", "", CS_8859_9},
/* aliases for ISO-8859-6: */
{"ISO_8859-6:1987", "", CS_8859_6},
{"iso-ir-127", "", CS_8859_6},
{"ISO_8859-6", "", CS_8859_6},
{"ECMA-114", "", CS_8859_6},
{"ASMO-708", "", CS_8859_6},
{"arabic", "", CS_8859_6},
{"csISOLatinArabic", "", CS_8859_6},
/* aliases for ISO_8859-6-i: */
{"csISO88596I", "", CS_8859_6_I},
/* aliases for ISO_8859-6-e: */
{"csISO88596E", "", CS_8859_6_E},
/* aliases for ISO-8859-8: */
{"iso-ir-138", "", CS_8859_8},
{"ISO_8859-8", "", CS_8859_8},
{"hebrew", "", CS_8859_8},
{"csISOLatinHebrew", "", CS_8859_8},
/* aliases for ISO_8859-8-i: */
{"csISO88598I", "", CS_8859_8_I},
/* aliases for ISO_8859-8-e: */
{"csISO88598E", "", CS_8859_8_E},
/* aliases for ISO-IR-111: */
{"ECMA-cyrillic", "", CS_ISO_IR_111},
{"csISO111ECMACyrillic", "", CS_ISO_IR_111},
/* aliases for TIS-620: */
{"x-tis-620", "", CS_TIS620},
/* aliases for T.61-8bit: */
{"T.61", "", CS_T61},
{"iso-ir-103", "", CS_T61},
{"csISO103T618bit", "", CS_T61},
{"", "", CS_UNKNOWN},
};

Просмотреть файл

@ -356,42 +356,54 @@ MODULE_PRIVATE cscvt_t cscvt_tbl[] = {
/* UNICODE */
{CS_UTF8, CS_UTF8, 0, (CCCFunc)mz_mbNullConv, INTL_CHARLEN_UTF8},
/*************** Vietnamese ****************/
{CS_VIET_VIQR, CS_VIET_VIQR, 0, (CCCFunc)0, 0},
{CS_VIET_VISCII, CS_VIET_VISCII, 0, (CCCFunc)0, 0},
{CS_VIET_VPS, CS_VIET_VPS, 0, (CCCFunc)0, 0},
{CS_VIET_TCVN, CS_VIET_TCVN, 0, (CCCFunc)0, 0},
{CS_VIET_VNI, CS_VIET_VNI, 0, (CCCFunc)0, 0},
{CS_CP_1258, CS_CP_1258, 0, (CCCFunc)0, 0},
{CS_VIET_VIQR, CS_VIET_VISCII, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_VIET_VPS, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_VIET_TCVN, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_CP_1258, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_VPS, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_TCVN, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_CP_1258, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_VISCII, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_TCVN, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_CP_1258, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VISCII, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VPS, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_CP_1258, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VISCII, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VPS, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_TCVN, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_CP_1258, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_CP_1258, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_CP_1258, CS_VIET_VISCII, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_CP_1258, CS_VIET_VPS, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_CP_1258, CS_VIET_TCVN, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_CP_1258, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_UTF8, 0, (CCCFunc)viet_any_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_UTF8, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_UTF8, CS_VIET_VISCII, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_UTF8},
/*************** Vietnamese ****************/
{CS_VIET_VIQR, CS_VIET_VIQR, 0, (CCCFunc)0, 0},
{CS_VIET_VISCII, CS_VIET_VISCII, 0, (CCCFunc)0, 0},
{CS_VIET_VPS, CS_VIET_VPS, 0, (CCCFunc)0, 0},
{CS_VIET_TCVN, CS_VIET_TCVN, 0, (CCCFunc)0, 0},
{CS_VIET_VNI, CS_VIET_VNI, 0, (CCCFunc)0, 0},
{CS_VIET_VPS, CS_VIET_VISCII, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VISCII, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_VPS, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VPS, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_TCVN, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_TCVN, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_VIET_VISCII, 0, (CCCFunc)viet_viqr_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_VIET_VPS, 0, (CCCFunc)viet_viqr_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_VIET_TCVN, 0, (CCCFunc)viet_viqr_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VISCII, 0, (CCCFunc)viet_vni_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VPS, 0, (CCCFunc)viet_vni_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_TCVN, 0, (CCCFunc)viet_vni_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_viqr, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_viqr, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_viqr, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VIQR, 0, (CCCFunc)viet_any_2_viqr, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_vni, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_TCVN, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_vni, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VPS, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_vni, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VNI, CS_VIET_VNI, 0, (CCCFunc)viet_any_2_vni, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VIQR, CS_UTF8, 0, (CCCFunc)viet_viqr_2_any, INTL_CHARLEN_SINGLEBYTE},
{CS_VIET_VISCII, CS_UTF8, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_SINGLEBYTE},
{CS_UTF8, CS_VIET_VISCII, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_UTF8},
/*******************************************/
{CS_T61, CS_UTF8, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_T61},
{CS_UTF8, CS_T61, 0, (CCCFunc)mz_AnyToAnyThroughUCS2, INTL_CHARLEN_UTF8},
@ -997,6 +1009,7 @@ PUBLIC int16 INTL_DocToWinCharSetID(int16 csid)
(def_doccsid == CS_VIET_VPS) ||
(def_doccsid == CS_VIET_TCVN) ||
(def_doccsid == CS_VIET_VNI) ||
(def_doccsid == CS_CP_1258) ||
(def_doccsid == CS_VIET_VIQR)
)) {
def_doccsid = 0;

Просмотреть файл

@ -1,352 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* intlpriv.h */
#ifndef _INTLPRIV_H_
#define _INTLPRIV_H_
#include "xp.h"
#include "intl_csi.h"
#include "libi18n.h"
#define UNCVTBUF_SIZE 8 /* At least: longest ESC Seq + Char Bytes - 1 */
#define DOC_CSID_KNOWN(x) (((x) != CS_DEFAULT) && ((x) != CS_UNKNOWN))
/* Some constants for UCS-2 detection */
#define BYTE_ORDER_MARK 0xFEFF
#define NEEDS_SWAP_MARK 0xFFFE
/*
* UTF8 defines and macros
*/
#define ONE_OCTET_BASE 0x00 /* 0xxxxxxx */
#define ONE_OCTET_MASK 0x7F /* x1111111 */
#define CONTINUING_OCTET_BASE 0x80 /* 10xxxxxx */
#define CONTINUING_OCTET_MASK 0x3F /* 00111111 */
#define TWO_OCTET_BASE 0xC0 /* 110xxxxx */
#define TWO_OCTET_MASK 0x1F /* 00011111 */
#define THREE_OCTET_BASE 0xE0 /* 1110xxxx */
#define THREE_OCTET_MASK 0x0F /* 00001111 */
#define FOUR_OCTET_BASE 0xF0 /* 11110xxx */
#define FOUR_OCTET_MASK 0x07 /* 00000111 */
#define FIVE_OCTET_BASE 0xF8 /* 111110xx */
#define FIVE_OCTET_MASK 0x03 /* 00000011 */
#define SIX_OCTET_BASE 0xFC /* 1111110x */
#define SIX_OCTET_MASK 0x01 /* 00000001 */
#define IS_UTF8_1ST_OF_1(x) (( (x)&~ONE_OCTET_MASK ) == ONE_OCTET_BASE)
#define IS_UTF8_1ST_OF_2(x) (( (x)&~TWO_OCTET_MASK ) == TWO_OCTET_BASE)
#define IS_UTF8_1ST_OF_3(x) (( (x)&~THREE_OCTET_MASK) == THREE_OCTET_BASE)
#define IS_UTF8_1ST_OF_4(x) (( (x)&~FOUR_OCTET_MASK ) == FOUR_OCTET_BASE)
#define IS_UTF8_1ST_OF_5(x) (( (x)&~FIVE_OCTET_MASK ) == FIVE_OCTET_BASE)
#define IS_UTF8_1ST_OF_6(x) (( (x)&~SIX_OCTET_MASK ) == SIX_OCTET_BASE)
#define IS_UTF8_2ND_THRU_6TH(x) \
(( (x)&~CONTINUING_OCTET_MASK ) == CONTINUING_OCTET_BASE)
#define IS_UTF8_1ST_OF_UCS2(x) \
IS_UTF8_1ST_OF_1(x) \
|| IS_UTF8_1ST_OF_2(x) \
|| IS_UTF8_1ST_OF_3(x)
/* Some constants for UCS-2 detection */
#define BYTE_ORDER_MARK 0xFEFF
#define NEEDS_SWAP_MARK 0xFFFE
/* exported functions from unicvt.c */
MODULE_PRIVATE UNICVTAPI unsigned char *mz_ucs2utf8(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_ucs2utf7(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_utf82ucs(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_utf82ucsswap(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_utf72utf8(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_utf82utf7(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_imap4utf72utf8(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI unsigned char *mz_utf82imap4utf7(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE UNICVTAPI int16 utf8_to_ucs2_char(const unsigned char *utf8p, int16 buflen, uint16 *ucs2p);
MODULE_PRIVATE UNICVTAPI int32 utf8_to_ucs2_buffer(const unsigned char *utf8p, int16 utf8len, int *parsed_cnt, int *invalid_cnt, uint16 *ucs2p, int32 ucs2len);
/* values for ASCII chars */
#define ESC 0x1B /* ESC character */
#define NL 0x0A /* newline */
#undef CR
#define CR 0x0D /* carriage return */
#define DOLLAR 0x24 /* carriage return */
/* values for EUC shift chars */
#define SS2 0x8E /* Single Shift 2 */
#define SS3 0x8F /* Single Shift 3 */
/* JIS encoding mode flags */
#define JIS_Roman 0
#define JIS_208_83 1
#define JIS_HalfKana 2
#define JIS_212_90 3
/* I am using low nibble for the ESC flag and the next high nibble for Shift */
#define KSC_5601_87 0x04
/* Default state is SHIFT_OUT when we begin.
* So SHIFT_IN should have value 0x0- */
#define SHIFT_IN 0x00
#define SHIFT_OUT 0x10
/* The actual values to be output for SHIFTING */
#define SO 0x0e
#define SI 0x0f
/* Some masks for computation */
#define ESC_MASK 0x0F
#define SHIFT_MASK 0xF0
/*
* Shift JIS Encoding
* 1st Byte Range 2nd Byte Range
* ASCII/JIS-Roman 0x21-0x7F n/a
* 2-Byte Char(low range) 0x81-0x9F 0x40-0x7E, 0x80-0xFC
* Half-width space(non-std) 0xA0 n/a
* Half-width katakana 0xA1-0xDF n/a
* 2-Byte Char(high range) 0xE0-0xEF 0x40-0x7E, 0x80-0xFC
* User Defined(non-std) 0xF0-0xFC 0x40-0x7E, 0x80-0xFC
*
* JIS Encoding
* 1st Byte Range 2nd Byte Range
* ASCII/JIS-Roman 0x21-0x7E n/a
* Half-width katakana(non-std) 0x21-0x5F n/a
* 2-Byte Char 0x21-7E 0x21-7E
*
* Japanese EUC Encoding
* 1st Byte Range 2nd Byte Range 3rd Byte Range
* ASCII/JIS-Roman 0x21-0x7E n/a n/a
* JIS X 0208-1990 0xA0-0xFF 0xA0-0xFF n/a
* Half-width katakana SS2 0xA0-0xFF n/a
* JIS X 0212-1990 SS3 0xA0-0xFF 0xA0-0xFF
*
*
* List of ISO2022-INT Escape Sequences:
*
* SUPPORTED:
* ASCII ESC ( B G0
* JIS X 0201-Roman ESC ( J G0
* Half-width Katakana ESC ( I
* JIS X 0208-1978 ESC $ @ G0
* JIS X 0208-1983 ESC $ B G0
* JIS X 0212-1990 ESC $ ( D G0 (to EUC only)
* ISO8859-1 ESC - A G1
*
* UNSUPPORTED:
* GB 2312-80 ESC $ A G0
* KS C 5601-1987 ESC $ ) C G1
* CNS 11643-1986-1 ESC $ ( G G0
* CNS 11643-1986-2 ESC $ ( H G0
* ISO8859-7(Greek) ESC - F G1
*
* Added right parens: ))))) to balance editors' showmatch...
*/
/* JIS-Roman mode enabled by 3 char ESC sequence: <ESC> ( J */
#define InsRoman_ESC(cp, obj) { \
INTL_SetCCCJismode(obj, JIS_Roman); \
*cp++ = ESC; \
*cp++ = '('; \
*cp++ = 'J'; \
}
/* ASCII mode enabled by 3 char ESC sequence: <ESC> ( B */
#define InsASCII_ESC(cp, obj) { \
INTL_SetCCCJismode(obj, JIS_Roman); \
*cp++ = ESC; \
*cp++ = '('; \
*cp++ = 'B'; \
}
/* JIS x208-1983 mode enabled by 3 char ESC sequence: <ESC> $ B */
#define Ins208_83_ESC(cp, obj) { \
INTL_SetCCCJismode(obj, JIS_208_83); \
*cp++ = ESC; \
*cp++ = '$'; \
*cp++ = 'B'; \
}
/* JIS Half-width katakana mode enabled by 3 char ESC seq.: ESC ( I */
#define InsHalfKana_ESC(cp, obj) { \
INTL_SetCCCJismode(obj, JIS_HalfKana); \
*cp++ = ESC; \
*cp++ = '('; \
*cp++ = 'I'; \
}
/* JIS x212-1990 mode enabled by 4 char ESC sequence: <ESC> $ ( D */
#define Ins212_90_ESC(cp, obj) { \
INTL_SetCCCJismode(obj, JIS_212_90); \
*cp++ = ESC; \
*cp++ = '$'; \
*cp++ = '('; \
*cp++ = 'D'; \
}
/* KSC 5601-1987 mode enabled by 4 char ESC sequence: <ESC> $ ) D */
#define Ins5601_87_ESC(cp, obj) { \
INTL_SetCCCJismode(obj, (INTL_GetCCCJismode(obj) & ~ESC_MASK) | KSC_5601_87); \
*cp++ = ESC; \
*cp++ = '$'; \
*cp++ = ')'; \
*cp++ = 'C'; \
}
#define Ins5601_87_SI(cp, obj) { \
INTL_SetCCCJismode(obj, ((INTL_GetCCCJismode(obj) & ~SHIFT_MASK) | SHIFT_IN)); \
*cp++ = SI; \
}
#define Ins5601_87_SO(cp, obj) { \
INTL_SetCCCJismode(obj, ((INTL_GetCCCJismode(obj) & ~SHIFT_MASK) | SHIFT_OUT)); \
*cp++ = SO; \
}
#define IsIns5601_87_ESC(obj) ((INTL_GetCCCJismode(obj) & ESC_MASK) == KSC_5601_87)
#define IsIns5601_87_SI(obj) ((INTL_GetCCCJismode(obj) & SHIFT_MASK) == SHIFT_IN)
#define IsIns5601_87_SO(obj) ((INTL_GetCCCJismode(obj) & SHIFT_MASK) == SHIFT_OUT)
/* Added right parens: )))))) to balance editors' showmatch... */
/* Maximum Length of Escape Sequence and Character Bytes per Encoding */
#define MAX_SJIS 2
#define MAX_EUC 3
#define MAX_JIS 6
#define MAX_CSNAME 64
typedef struct _csname2id_t {
unsigned char cs_name[MAX_CSNAME];
unsigned char java_name[MAX_CSNAME];
int16 cs_id;
unsigned char fill[3];
} csname2id_t;
typedef struct {
int16 from_csid; /* "from" codeset ID */
int16 to_csid; /* "to" codeset ID */
int16 autoselect; /* autoselectable */
CCCFunc cvtmethod; /* char. codeset conv method */
int32 cvtflag; /* conv func dependent flag */
} cscvt_t;
#ifdef XP_UNIX
typedef struct {
int16 win_csid;
char *locale;
char *fontlist;
} cslocale_t;
#endif /* XP_UNIX */
XP_BEGIN_PROTOS
MODULE_PRIVATE int net_1to1CCC(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE int net_sjis2jis(CCCDataObject,const unsigned char *s,int32 l);
MODULE_PRIVATE int net_sjis2euc(CCCDataObject,const unsigned char *s,int32 l);
MODULE_PRIVATE int net_euc2jis(CCCDataObject,const unsigned char *s, int32 l);
MODULE_PRIVATE int net_euc2sjis(CCCDataObject,const unsigned char *s,int32 l);
MODULE_PRIVATE int net_jis2other(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_euc2jis(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_sjis2euc(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_sjis2jis(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *One2OneCCC(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_euc2sjis(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_euckr2iso(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_iso2euckr(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_b52cns(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *mz_cns2b5(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *jis2other(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *autoJCCC (CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *autoKCCC (CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE int16 intl_detect_JCSID (uint16, const unsigned char *, int32);
MODULE_PRIVATE int16 intl_detect_KCSID (uint16, const unsigned char *, int32);
MODULE_PRIVATE unsigned char *viet_any_2_viqr(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *viet_viqr_2_any(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *viet_vni_2_any(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *viet_any_2_vni(CCCDataObject, const unsigned char *s, int32 l);
MODULE_PRIVATE unsigned char *
mz_AnyToAnyThroughUCS2(CCCDataObject obj,const unsigned char *buf, int32 bufsz);
void FE_fontchange(iDocumentContext window_id, int16 csid);
void FE_ChangeURLCharset(const char *newCharset);
char ** FE_GetSingleByteTable(int16 from_csid, int16 to_csid, int32 resourceid);
char * FE_LockTable(char **cvthdl);
void FE_FreeSingleByteTable(char **cvthdl);
/* void CCCReportAutoDetect(CCCDataObject obj, uint16 detected_doc_csid); */
unsigned char *ConvHeader(unsigned char *subject);
#ifdef XP_UNIX
int16 FE_WinCSID(iDocumentContext );
#else /* XP_UNIX */
#define FE_WinCSID(window_id) 0
#endif /* XP_UNIX */
int16 *intl_GetFontCharSets(void);
/**
* Access a conversion flag for hankaku->zenkaku kana conversion for mail.
*
* The conversion flag for JIS, set if converting hankaku (1byte) kana to zenkaku (2byte).
* The flag is needed in order to control the conversion. Kana conversion should be applied
* only when sending a mail and converters do not know if they are called for mail sending.
*
* @param obj Character code converter.
* @return TRUE if convert to zenkaku (2byte).
* @see INTL_SetCCCCvtflag_SendHankakuKana
*/
MODULE_PRIVATE XP_Bool INTL_GetCCCCvtflag_SendHankakuKana(CCCDataObject obj);
/**
* Access a conversion flag for hankaku->zenkaku kana conversion for mail.
*
* The conversion flag for JIS, set if converting hankaku (1byte) kana to zenkaku (2byte).
* The flag is needed in order to control the conversion. Kana conversion should be applied
* only when sending a mail and converters do not know if they are called for mail sending.
*
* @param obj Character code converter.
* @see INTL_GetCCCCvtflag_SendHankakuKana
*/
MODULE_PRIVATE void INTL_SetCCCCvtflag_SendHankakuKana(CCCDataObject obj, XP_Bool flag);
/**
* Front end implementation for INTL_GetCharSetID.
*
* @param selector Specification for a charset ID to get.
* @return Charset ID for the input selector. Returns CS_DEFUALT in case of error (e.g. selector invalid).
* @see INTL_GetCharSetID.
*/
INTLCharSetID FE_GetCharSetID(INTL_CharSetID_Selector selector);
XP_END_PROTOS
#define MAXCSIDINTBL 128
#endif /* _INTLPRIV_H_ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу