RICHEDIT: RTF reader i18n (now with font charset support)

Phil Krylov phil at
Mon Mar 21 06:45:23 CST 2005

On Mon, 21 Mar 2005 14:40:38 +0300
Vitaly Lipatov <lav at> wrote:

> > > Will we do this code in locale independent manner? Why we have
> > > ansiCodePage=1252 by default?
> >
> > It is locale independent. 1252 is the default value used if RTF does not
> > specify another codepage (which almost never happens). If I used
> > GetACP() here, the same RTF document would be differently imported
> > depending on user locale. RTF is not supposed to act like this. If RTF
> If I try open RTF where codepage is not specified, guessed codepage must be 
> the same as ACP. For instance if I get such file here in Russia, I suppose it 
> in cp1251 codepage.
> > does not specify any codepage it means that it uses CP1252.
> I recommend use GetACP, otherwise in will some disadvantage for non cp1252 
> users.
> > How do you find this code is locale dependent? IMHO it's _in_dependent of
> > locale.
> I worry only about default codepage.

OK, I've made some tests using the original M$ richedit, and they show the
following: \ansicpg keyword in the RTF header does not affect the used encoding
when importing RTF. The encoding used for import is determined by \fcharset
setting for the "current" font. If it specifies \fcharset1 (DEFAULT_CHARSET)
or is omitted, GetACP() is used. If it specifies \fcharset0 (ANSI_CHARSET),
CP1252 is used regardless of current locale. For other charsets, their
respective codepages are used.

I'll commit the required changes to the RTF reader soon.

-- Ph.

More information about the wine-devel mailing list