Re: [Fwd]: Re: final bits for CJK patch


Subject: Re: [Fwd]: Re: final bits for CJK patch
From: Chih-Wei Huang (cwhuang@linux.org.tw)
Date: Sat Nov 11 2000 - 09:19:12 CST


ha shao ¼g¹D¡G
>
> Could you take a look at my proposal? Or maybe test it for
> BIG5 codes. If you think it is good or have better ideas, I will
> tell Vald. Otherwise, I will throw it into garbage can.
>
> Save ascii char in \'hh will bloat any English files 4 times
> bigger.

Hello, Vlad,
please consider to add this patch suggested by hashao,
that save ascii char in its original form instead of \'hh.
I have tested it in Big5 locale, but not zh_CN.GB2312,
it seems no problem.
I only changed hashao's code
if (mbbuf[0] > 0x007f)
to
if (mbbuf[0] & 0x80)
since *mbbuf is char, which never greater than 0x007f.

This patch should be applied after your p4 patch.

-- 
   ~     Chih-Wei Huang (cwhuang)
  'v'    E-Mail       : cwhuang@linux.org.tw
 // \\   CLDP Project : http://www.linux.org.tw/CLDP/ (Coordinator)
/(   )\  CLE  Project : http://cle.linux.org.tw/CLE/  (Developer)
 ^`~'^   HomePage     : http://www.cwhuang.idv.tw/

--- src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp.bak Sat Nov 11 23:04:00 2000 +++ src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp Sat Nov 11 23:09:51 2000 @@ -196,11 +196,19 @@ { /*FIXME: can it happen that wctomb will fail under CJK locales? */ m_wctomb.wctomb_or_fallback(mbbuf,mblen,*pData++); - for(int i=0;i<mblen;++i) { - /* unfortunately all english letters will be output as \'hh too. */ - unsigned char c = mbbuf[i]; + if (mbbuf[0] & 0x80) + { FlushBuffer(); - m_pie->_rtf_nonascii_hex2(c); + for(int i=0;i<mblen;++i) { + unsigned char c = mbbuf[i]; + m_pie->_rtf_nonascii_hex2(c); + } + } + else + { + for(int i=0;i<mblen;++i) { + *pBuf++ = mbbuf[i]; + } } } else if (!m_pie->m_atticFormat) {



This archive was generated by hypermail 2b25 : Sat Nov 11 2000 - 09:22:08 CST