Re: More RTF importer bug fixes and RFC (PATCH)

From: Roland Kay <roland.kay_at_ox.compsoc.net>
Date: Fri Jun 03 2005 - 13:45:26 CEST

Hi Tomas,

Thanks for the hint. I've tracked the corruption of UTF8 characters
to the PP_AttrProp::setProperty() function in
src/text/ptbl/xp/pp_AttrProp.cpp.

On line 440 that function calls s_validXML() on property values:

static inline void s_validXML(char * s)
{
        if(!s)
                return;

        while(*s)
        {
                if(*s < ' ' && *s != '\t' && *s != '\n' && *s != '\r')
                {
                        *s = '~';
                }

                ++s;
        }
}

Because s is declared "char" and not "unsigned char" that "*s<' '" picks
up all of the 8 bit characters. I assume it's not meant to. The attached
patch adds a *s>0 clause which solves the problem. (Although, the font
preview still displays squares instead of the real characters, but that's
less serious).

If this is all correct and you're happy to apply the pataches I sent in my
previous email then please do so. I'll then send another which displays
the Chinese font name instead of the alternative. (it will depend on
RTF-AltFontName-ver2.patch).

Thanks for your help,

R.

Received on Fri Jun 3 13:47:57 2005

This archive was generated by hypermail 2.1.8 : Fri Jun 03 2005 - 13:47:57 CEST