On Wed, Nov 15, 2000 at 12:18:58AM +0800, [EMAIL PROTECTED] wrote:
> Hi guys,
>
> Finally, got it all sort out. 2 patches. One patches the
> ie_imp_MsWord_97.cpp. It sets chartype to 1 for word version
> equal or lower than WORD6. Word 6 don't use unicode at all.
> So always do converting.
>
> Another patches the wv/text.c. Now correctly work on
> wvHandleCodePage with multibyte Characters too.
>
On 2nd thought, the changes in ie_imp_MsWord_97.cpp should be moved
into wv itself. This will make things more generic.
New patch wv-codepage2.diff replace the above 2 patches.
--
Best regard
ha_shao
Index: text.c
===================================================================
RCS file: /cvsroot/wv/text.c,v
retrieving revision 1.51
diff -u -r1.51 text.c
--- text.c 2000/11/10 13:30:40 1.51
+++ text.c 2000/11/14 18:41:24
@@ -17,8 +17,10 @@
{
U16 lid;
/* testing adding a language */
- lid = achp->lidDefault;
- if (lid == 0x400)
+ lid = achp->lidDefault;
+ /* No lidDefault for ver < WORD6 */
+ /* Should try achp->lid first? */
+ if (lid == 0x400 || lid == 0)
lid = ps->fib.lid;
/* end testing adding a language */
@@ -37,7 +39,13 @@
{
/* Most Chars go through this baby */
if (charhandler)
+ {
+ if (wvQuerySupported(&ps->fib,NULL) <= WORD6)
+ {
+ chartype = 1; /* WORD6 do not use unicode */
+ }
return( (*charhandler)(ps,eachchar,chartype,lid) );
+ }
}
wvError(("No CharHandler registered, programmer error\n"));
return(0);
@@ -167,10 +175,19 @@
size_t obuflen; /* Length of output buffer */
const char *ibuf;
char *codepage;
- char buffer[1];
+ char buffer[2]; /* eachchar > 255 */
char buffer2[2];
- buffer[0]= (char)eachchar;
+ if(eachchar > 0xff)
+ {
+ buffer[0]= (char)(eachchar >> 8);
+ buffer[1]= (char)eachchar & 0xff;
+ }
+ else
+ {
+ buffer[0] = eachchar & 0xff;
+ buffer[1] = 0;
+ }
ibuf = buffer;
obuf = buffer2;
@@ -192,8 +209,8 @@
return('?');
}
- ibuflen = 1;
- obuflen = 2;
+ ibuflen = 2;
+ obuflen = 2;
p = obuf;
iconv(iconv_handle, &ibuf, &ibuflen, &obuf, &obuflen);
eachchar = (U8)*p++;