You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Roman Pozlevich <ro...@gorod.ru> on 2001/04/05 09:40:32 UTC

encodings support and windows-1251

Hi!

Russians use several charsets and most of them are not standard :-)
Windows-1251 is de-facto standard for Windows users and widely used as
default charset on the Web.  I run Linux and my "native" charset is
koi8-r, but I have to respect preferences of the rest of Russian part
of the Internet.

Xalan-j_2_0_1 has no internal support for windows-1251.  Nevertheless
it works, because windows-1251 is supported by all versions of Java.

What's wrong?  If windows-1251 is specified as output encoding Xalan
encodes cyrillic characters in Unicode entities (I mean &#XXXX;) on
XML serialization.  In most cases it's Ok, but extra encoding is speed
loss.  In some cases getting entities instead of real characters is
completely inacceptable.

I took a look at the sources and found that charsets support is a bit
strange.  There is very simple check which characters have to be
printed as is and which have to be encoded.  It's much like initial
support ("hibyte") for charsets in ancient Java versions.  I'm not
sure that's right.

I'll try to rework that and submit "serious" patch later if I have
time.  Here is a workaround patch attached to make things better with
windows-1251 charset.

-- 
Roman Pozlevich              e-mail: roma@gorod.ru
                             phone: +7 (095) 777-78-00