From 55dc3ba80449a3ebe158eae80e29bb7a41bfb50e Mon Sep 17 00:00:00 2001 From: "yueheng.xu%intel.com" Date: Wed, 3 May 2000 01:59:55 +0000 Subject: [PATCH] fix for #31380 (Unicode to GBK converter not working for some GBK chars) reported and fix suggested by Xianping Ge ( xge@ics.uci.edu). git-svn-id: svn://10.0.0.236/trunk@68009 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/intl/uconv/ucvcn/nsUnicodeToGBK.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mozilla/intl/uconv/ucvcn/nsUnicodeToGBK.cpp b/mozilla/intl/uconv/ucvcn/nsUnicodeToGBK.cpp index 142a8cf919b..d6214b8308c 100644 --- a/mozilla/intl/uconv/ucvcn/nsUnicodeToGBK.cpp +++ b/mozilla/intl/uconv/ucvcn/nsUnicodeToGBK.cpp @@ -110,8 +110,8 @@ NS_IMETHODIMP nsUnicodeToGBK::ConvertNoBuff(const PRUnichar * aSrc, if ( unicode == GBKToUnicodeTable[i] ) { //this manipulation handles the little endian / big endian issues - left = (PRUint8) ( i / 0x00BF + 0x0081) | 0x80 ; - right = (PRUint8) ( i % 0x00BF+ 0x0040) | 0x80; + left = (PRUint8) ( i / 0x00BF + 0x0081); + right = (PRUint8) ( i % 0x00BF+ 0x0040); pDestDBCode->leftbyte = left; pDestDBCode->rightbyte = right; } @@ -184,11 +184,11 @@ NS_IMETHODIMP nsUnicodeToGBK::FillInfo(PRUint32 *aInfo) // valid GBK rows are in 0x81 to 0xFE for ( i=0x0081; i<=0x00FF; i++) { - // valid GBK columns are in 0x41 to 0xFE - for( j=0x0041; j<0x00FF; j++) + // valid GBK columns are in 0x40 to 0xFE + for( j=0x0040; j<0x00FF; j++) { // k is index in GBKU.H table - k = (i - 0x0081)*(0xFE - 0x0080)+(j-0x0041); + k = (i - 0x0081)*(0xFE - 0x0080)+(j-0x0040); SrcUnicode = GBKToUnicodeTable[k]; if (( SrcUnicode != 0xFFFF ) && (SrcUnicode != 0xFFFD) ) {