Re: Bug #471 (Word files on NT4)

Justin Bradford (justin@ukans.edu)
Sun, 8 Aug 1999 05:44:32 -0500 (CDT)


> This is the call returning > 0 and therefore causing the import of the
> file to fail. The only way I found to solve this problem is by putting
>
> setlocale( LC_CTYPE, "C" );
>
> before the call to isprint() (don't forget to #include <locale.h>). I
> don't, however, know what the locale is set to before that call (and what
> is therefore causing isprint() to act stupid),

Here's my theory:
As the debug-enabled versions imported Word docs fine, too, Windows NT
must not set default locale until you try to print something (by
calling *printf function). So in non-debug versions, a *printf is never
called, and it hits the isprint with an undefined locale. And with debug
versions, there are lots of calls to *printf, which sets the locale to a
default of C and then manages the isprint fine.

In CVS, someone has recently modified it to not even bother with the
isprint test block. That version should work, too. I figure Caolan should
make the final decision on how to handle this (keep the isprint test
[using setlocale] or just remove the block [it is just a sanity check]?).

Also, there is a version of Word which outputs RTF with a .doc label. I
have encountered this, and the importer said it was normal text causing
me to inspect it, recognize the RTF, and then use the RTF importer
explicitly. If we keep a test which recognizes that the file is text, we
can automate that process for the user. wv says it's text, so try RTF, and
if that doesn't work, maybe we could just feed it to the text importer.

Anyway, Thomas, thanks for your help in figuring out exactly what was
going wrong.

Justin



This archive was generated by hypermail 1.03b2.