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.
Load wordpad.doc with no problem.
--
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 16:05:53
@@ -17,8 +17,9 @@
{
U16 lid;
/* testing adding a language */
- lid = achp->lidDefault;
- if (lid == 0x400)
+ lid = achp->lidDefault;
+ /* No lidDefault for ver < WORD6 */
+ if (lid == 0x400 || lid == 0)
lid = ps->fib.lid;
/* end testing adding a language */
@@ -167,10 +168,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 > 255)
+ {
+ buffer[0]= (char)(eachchar >> 8);
+ buffer[1]= (char)eachchar & 0xff;
+ }
+ else
+ {
+ buffer[0] = eachchar & 0xff;
+ buffer[1] = 0;
+ }
ibuf = buffer;
obuf = buffer2;
@@ -192,8 +202,8 @@
return('?');
}
- ibuflen = 1;
- obuflen = 2;
+ ibuflen = 2;
+ obuflen = 2;
p = obuf;
iconv(iconv_handle, &ibuf, &ibuflen, &obuf, &obuflen);
eachchar = (U8)*p++;
@@ -236,6 +246,7 @@
strcpy(f_code,"UCS-2");
strcpy(t_code,outputtype);
+printf("output type: %s\n", outputtype);
iconv_handle = iconv_open(t_code,f_code);
if (iconv_handle == (iconv_t)-1)
Index: ie_imp_MsWord_97.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_MsWord_97.cpp,v
retrieving revision 1.68
diff -u -r1.68 ie_imp_MsWord_97.cpp
--- ie_imp_MsWord_97.cpp 2000/11/14 07:52:15 1.68
+++ ie_imp_MsWord_97.cpp 2000/11/14 16:06:35
@@ -153,7 +153,10 @@
int CharProc(wvParseStruct *ps,U16 eachchar,U8 chartype,U16 lid)
{
IE_Imp_MsWord_97* pDocReader = (IE_Imp_MsWord_97 *) ps->userData;
-
+ if (wvQuerySupported(&ps->fib, NULL) <= WORD6)
+ {
+ chartype = 1; // WORD6 do not use unicode
+ }
// convert incoming character to unicode
if (chartype)
eachchar = wvHandleCodePage(eachchar, lid);