fix Chinease/Korean encoder problem
git-svn-id: svn://10.0.0.236/trunk@34255 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -18,20 +18,11 @@
|
||||
*/
|
||||
|
||||
#include "nsGB2312ToUnicode.h"
|
||||
|
||||
|
||||
#include "nsUCvCnDll.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_ASCIIMappingTable[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
static PRUint16 g_GB2312MappingTable[] = {
|
||||
#include "gb2312.ut"
|
||||
};
|
||||
|
||||
|
||||
static PRInt16 g_ASCIIShiftTable[] = {
|
||||
0, u1ByteCharset,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
@@ -48,8 +39,8 @@ static PRInt16 *g_GB2312ShiftTableSet [] = {
|
||||
};
|
||||
|
||||
static PRUint16 *g_GB2312MappingTableSet [] ={
|
||||
g_ASCIIMappingTable,
|
||||
g_GB2312MappingTable
|
||||
g_AsciiMapping,
|
||||
g_utGB2312Mapping
|
||||
};
|
||||
|
||||
static uRange g_GB2312Ranges[] = {
|
||||
|
||||
@@ -48,6 +48,17 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
PRInt32 g_InstanceCount = 0;
|
||||
PRInt32 g_LockCount = 0;
|
||||
|
||||
PRUint16 g_AsciiMapping[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
PRUint16 g_utGB2312Mapping[] = {
|
||||
#include "gb2312.ut"
|
||||
};
|
||||
PRUint16 g_ufGB2312Mapping[] = {
|
||||
#include "gb2312.uf"
|
||||
};
|
||||
|
||||
|
||||
typedef nsresult (* fpCreateInstance) (nsISupports **);
|
||||
|
||||
struct FactoryData
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
extern PRInt32 g_InstanceCount;
|
||||
extern PRInt32 g_LockCount;
|
||||
extern "C" PRInt32 g_InstanceCount;
|
||||
extern "C" PRInt32 g_LockCount;
|
||||
|
||||
extern "C" PRUint16 g_AsciiMapping[];
|
||||
extern "C" PRUint16 g_utGB2312Mapping[];
|
||||
extern "C" PRUint16 g_ufGB2312Mapping[];
|
||||
|
||||
#endif /* nsUCvCnDll_h___ */
|
||||
|
||||
@@ -18,26 +18,38 @@
|
||||
*/
|
||||
|
||||
#include "nsUnicodeToGB2312.h"
|
||||
#include "nsUCvCnDll.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_GB2312MappingTable[] = {
|
||||
#include "gb2312.uf"
|
||||
|
||||
static PRInt16 g_ASCIIShiftTable[] = {
|
||||
0, u1ByteCharset,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
static PRInt16 g_GB2312ShiftTable[] = {
|
||||
2, uMultibytesCharset,
|
||||
ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE)
|
||||
0, u2BytesGRCharset,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
static PRInt16 *g_GB2312ShiftTableSet [] = {
|
||||
g_ASCIIShiftTable,
|
||||
g_GB2312ShiftTable
|
||||
};
|
||||
|
||||
static PRUint16 *g_GB2312MappingTableSet [] ={
|
||||
g_AsciiMapping,
|
||||
g_ufGB2312Mapping
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToGB2312 [implementation]
|
||||
|
||||
nsUnicodeToGB2312::nsUnicodeToGB2312()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_GB2312ShiftTable,
|
||||
(uMappingTable*) &g_GB2312MappingTable)
|
||||
: nsMultiTableEncoderSupport(2,
|
||||
(uShiftTable**) &g_GB2312ShiftTableSet,
|
||||
(uMappingTable**) &g_GB2312MappingTableSet)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +70,6 @@ NS_IMETHODIMP nsUnicodeToGB2312::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
*aDestLength = 2 * aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @created 06/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToGB2312 : public nsTableEncoderSupport
|
||||
class nsUnicodeToGB2312 : public nsMultiTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -60,6 +60,6 @@ NS_IMETHODIMP nsUnicodeToSJIS::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = 3*aSrcLength;
|
||||
*aDestLength = 2*aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ CPPSRCS = \
|
||||
nsEUCJPToUnicode.cpp \
|
||||
nsISO2022JPToUnicode.cpp \
|
||||
nsUnicodeToEUCJP.cpp \
|
||||
nsUnicodeToJISx0201.cpp \
|
||||
nsUnicodeToJISx0208.cpp \
|
||||
nsUnicodeToJISx0212.cpp \
|
||||
nsUnicodeToISO2022JP.cpp \
|
||||
nsUCvJa2Support.cpp \
|
||||
nsUCVJA2Dll.cpp \
|
||||
@@ -39,6 +42,9 @@ CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsEUCJPToUnicode.obj \
|
||||
.\$(OBJDIR)\nsISO2022JPToUnicode.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToEUCJP.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToJISx0201.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToJISx0208.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToJISx0212.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToISO2022JP.obj \
|
||||
.\$(OBJDIR)\nsUCvJa2Support.obj \
|
||||
.\$(OBJDIR)\nsUCVJA2Dll.obj \
|
||||
|
||||
@@ -46,30 +46,30 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
|
||||
extern "C" PRInt32 g_InstanceCount = 0;
|
||||
extern "C" PRInt32 g_LockCount = 0;
|
||||
PRInt32 g_InstanceCount = 0;
|
||||
PRInt32 g_LockCount = 0;
|
||||
|
||||
extern "C" PRUint16 g_ut0201Mapping[] = {
|
||||
PRUint16 g_ut0201Mapping[] = {
|
||||
#include "jis0201.ut"
|
||||
};
|
||||
|
||||
extern "C" PRUint16 g_ut0208Mapping[] = {
|
||||
PRUint16 g_ut0208Mapping[] = {
|
||||
#include "jis0208.ut"
|
||||
};
|
||||
|
||||
extern "C" PRUint16 g_ut0212Mapping[] = {
|
||||
PRUint16 g_ut0212Mapping[] = {
|
||||
#include "jis0212.ut"
|
||||
};
|
||||
|
||||
extern "C" PRUint16 g_uf0201Mapping[] = {
|
||||
PRUint16 g_uf0201Mapping[] = {
|
||||
#include "jis0201.uf"
|
||||
};
|
||||
|
||||
extern "C" PRUint16 g_uf0208Mapping[] = {
|
||||
PRUint16 g_uf0208Mapping[] = {
|
||||
#include "jis0208.uf"
|
||||
};
|
||||
|
||||
extern "C" PRUint16 g_uf0212Mapping[] = {
|
||||
PRUint16 g_uf0212Mapping[] = {
|
||||
#include "jis0212.uf"
|
||||
};
|
||||
|
||||
|
||||
@@ -210,7 +210,9 @@ NS_IMETHODIMP nsUnicodeToISO2022JP::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// worst case
|
||||
*aDestLength = 5*aSrcLength;
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// ESC $ B XX XX ESC ( B
|
||||
*aDestLength = 8*aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,5 +53,5 @@ NS_IMETHODIMP nsUnicodeToJISx0201::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ NS_IMETHODIMP nsUnicodeToJISx0208::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = 2*aSrcLength;
|
||||
return NS_OK;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ NS_IMETHODIMP nsUnicodeToJISx0212::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = 2*aSrcLength;
|
||||
return NS_OK;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,12 @@
|
||||
*/
|
||||
|
||||
#include "nsEUCKRToUnicode.h"
|
||||
#include "nsUCvKODll.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_ASCIIMappingTable[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
|
||||
static PRInt16 g_ASCIIShiftTable[] = {
|
||||
static PRUint16 g_ASCIIShiftTable[] = {
|
||||
0, u1ByteCharset,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
@@ -36,7 +33,7 @@ static PRUint16 g_EUCKRMappingTable[] = {
|
||||
#include "u20ksc.ut"
|
||||
};
|
||||
|
||||
static PRInt16 g_EUCKRShiftTable[] = {
|
||||
static PRUint16 g_EUCKRShiftTable[] = {
|
||||
0, u2BytesCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0)
|
||||
};
|
||||
@@ -47,11 +44,7 @@ static uRange g_EUCKRRanges[] = {
|
||||
};
|
||||
#else
|
||||
|
||||
static PRUint16 g_EUCKRMappingTable[] = {
|
||||
#include "u20kscgl.ut"
|
||||
};
|
||||
|
||||
static PRInt16 g_EUCKRShiftTable[] = {
|
||||
static PRUint16 g_EUCKRShiftTable[] = {
|
||||
0, u2BytesGRCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0)
|
||||
};
|
||||
@@ -63,14 +56,14 @@ static uRange g_EUCKRRanges[] = {
|
||||
#endif
|
||||
|
||||
|
||||
static PRInt16 *g_EUCKRShiftTableSet [] = {
|
||||
static PRUint16 *g_EUCKRShiftTableSet [] = {
|
||||
g_ASCIIShiftTable,
|
||||
g_EUCKRShiftTable
|
||||
};
|
||||
|
||||
static PRUint16 *g_EUCKRMappingTableSet [] ={
|
||||
g_ASCIIMappingTable,
|
||||
g_EUCKRMappingTable
|
||||
g_AsciiMapping,
|
||||
g_utKSC5601Mapping
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,18 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
PRInt32 g_InstanceCount = 0;
|
||||
PRInt32 g_LockCount = 0;
|
||||
|
||||
PRUint16 g_utKSC5601Mapping[] = {
|
||||
#include "u20kscgl.ut"
|
||||
};
|
||||
|
||||
PRUint16 g_ufKSC5601Mapping[] = {
|
||||
#include "u20kscgl.uf"
|
||||
};
|
||||
|
||||
PRUint16 g_AsciiMapping[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
|
||||
typedef nsresult (* fpCreateInstance) (nsISupports **);
|
||||
|
||||
struct FactoryData
|
||||
|
||||
@@ -22,7 +22,12 @@
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
extern PRInt32 g_InstanceCount;
|
||||
extern PRInt32 g_LockCount;
|
||||
extern "C" PRInt32 g_InstanceCount;
|
||||
extern "C" PRInt32 g_LockCount;
|
||||
|
||||
|
||||
extern "C" PRUint16 g_utKSC5601Mapping[];
|
||||
extern "C" PRUint16 g_ufKSC5601Mapping[];
|
||||
extern "C" PRUint16 g_AsciiMapping[];
|
||||
|
||||
#endif /* nsUCvKODll_h___ */
|
||||
|
||||
@@ -18,26 +18,39 @@
|
||||
*/
|
||||
|
||||
#include "nsUnicodeToEUCKR.h"
|
||||
#include "nsUCvKODll.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_EUCKRMappingTable[] = {
|
||||
#include "u20kscgl.uf"
|
||||
|
||||
static PRUint16 gAsciiShiftTable[] = {
|
||||
0, u1ByteCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
static PRInt16 g_EUCKRShiftTable[] = {
|
||||
2, uMultibytesCharset,
|
||||
ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE)
|
||||
static PRUint16 gKSC5601ShiftTable[] = {
|
||||
0, u2BytesGRCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
static PRUint16 *g_EUCKRMappingTable[2] = {
|
||||
g_AsciiMapping,
|
||||
g_ufKSC5601Mapping
|
||||
};
|
||||
|
||||
static PRUint16 *g_EUCKRShiftTable[2] = {
|
||||
gAsciiShiftTable,
|
||||
gKSC5601ShiftTable
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToEUCKR [implementation]
|
||||
|
||||
nsUnicodeToEUCKR::nsUnicodeToEUCKR()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_EUCKRShiftTable,
|
||||
(uMappingTable*) &g_EUCKRMappingTable)
|
||||
: nsMultiTableEncoderSupport(2,
|
||||
(uShiftTable**) g_EUCKRShiftTable,
|
||||
(uMappingTable**) g_EUCKRMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +71,6 @@ NS_IMETHODIMP nsUnicodeToEUCKR::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
*aDestLength = aSrcLength * 2;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @created 06/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToEUCKR : public nsTableEncoderSupport
|
||||
class nsUnicodeToEUCKR : public nsMultiTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
// in theory it should be 6, but since we do not handle
|
||||
// UCS4 and UTF-16 here. It is 3. We should change it to 6 when we
|
||||
// support UCS4 or UTF-16
|
||||
*aDestLength = 3*aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
extern PRInt32 g_InstanceCount;
|
||||
extern PRInt32 g_LockCount;
|
||||
extern "C" PRInt32 g_InstanceCount;
|
||||
extern "C" PRInt32 g_LockCount;
|
||||
|
||||
#endif /* nsUCvTWDll_h___ */
|
||||
|
||||
@@ -22,22 +22,41 @@
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_BIG5MappingTable[] = {
|
||||
static PRUint16 g_ufBig5Mapping[] = {
|
||||
#include "big5.uf"
|
||||
};
|
||||
|
||||
static PRInt16 g_BIG5ShiftTable[] = {
|
||||
2, uMultibytesCharset,
|
||||
ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE)
|
||||
static PRUint16 gAsciiShiftTable[] = {
|
||||
0, u1ByteCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
static PRUint16 gBig5ShiftTable[] = {
|
||||
0, u2BytesCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
static PRUint16 g_AsciiMapping[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
|
||||
static PRUint16 *g_Big5MappingTable[2] = {
|
||||
g_AsciiMapping,
|
||||
g_ufBig5Mapping
|
||||
};
|
||||
|
||||
static PRUint16 *g_Big5ShiftTable[2] = {
|
||||
gAsciiShiftTable,
|
||||
gBig5ShiftTable
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToBIG5 [implementation]
|
||||
|
||||
nsUnicodeToBIG5::nsUnicodeToBIG5()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_BIG5ShiftTable,
|
||||
(uMappingTable*) &g_BIG5MappingTable)
|
||||
: nsMultiTableEncoderSupport(2,
|
||||
(uShiftTable**) &g_Big5ShiftTable,
|
||||
(uMappingTable**) &g_Big5MappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +77,6 @@ NS_IMETHODIMP nsUnicodeToBIG5::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
*aDestLength = 2 * aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @created 06/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToBIG5 : public nsTableEncoderSupport
|
||||
class nsUnicodeToBIG5 : public nsMultiTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
PRInt32 g_InstanceCount = 0;
|
||||
PRInt32 g_LockCount = 0;
|
||||
|
||||
|
||||
typedef nsresult (* fpCreateInstance) (nsISupports **);
|
||||
|
||||
struct FactoryData
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
extern PRInt32 g_InstanceCount;
|
||||
extern PRInt32 g_LockCount;
|
||||
extern "C" PRInt32 g_InstanceCount;
|
||||
extern "C" PRInt32 g_LockCount;
|
||||
|
||||
#endif /* nsUCvTW2Dll_h___ */
|
||||
|
||||
@@ -22,22 +22,52 @@
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_EUCTWMappingTable[] = {
|
||||
static PRUint16 g_ufCNS1MappingTable[] = {
|
||||
#include "cns_1.uf"
|
||||
};
|
||||
static PRUint16 g_ufCNS2MappingTable[] = {
|
||||
#include "cns_2.uf"
|
||||
};
|
||||
|
||||
static PRInt16 g_EUCTWShiftTable[] = {
|
||||
2, uMultibytesCharset,
|
||||
ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE)
|
||||
static PRUint16 g_ASCIIMappingTable[] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
|
||||
static PRInt16 g_ASCIIShiftTable[] = {
|
||||
0, u1ByteCharset,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
static PRInt16 g_CNS1ShiftTable[] = {
|
||||
0, u2BytesGRCharset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
static PRInt16 g_CNS2ShiftTable[] = {
|
||||
0, u2BytesGRPrefix8EA2Charset,
|
||||
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
|
||||
static PRInt16 *g_EUCTWShiftTableSet [] = {
|
||||
g_ASCIIShiftTable,
|
||||
g_CNS1ShiftTable,
|
||||
g_CNS2ShiftTable
|
||||
};
|
||||
|
||||
static PRUint16 *g_EUCTWMappingTableSet [] ={
|
||||
g_ASCIIMappingTable,
|
||||
g_ufCNS1MappingTable,
|
||||
g_ufCNS2MappingTable
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToEUCTW [implementation]
|
||||
|
||||
nsUnicodeToEUCTW::nsUnicodeToEUCTW()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_EUCTWShiftTable,
|
||||
(uMappingTable*) &g_EUCTWMappingTable)
|
||||
: nsMultiTableEncoderSupport( 3,
|
||||
(uShiftTable**) &g_EUCTWShiftTableSet,
|
||||
(uMappingTable**) &g_EUCTWMappingTableSet)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +88,6 @@ NS_IMETHODIMP nsUnicodeToEUCTW::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
*aDestLength = 4 * aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @created 06/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToEUCTW : public nsTableEncoderSupport
|
||||
class nsUnicodeToEUCTW : public nsMultiTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user