Differences calling Saxon8B (outof Oxygen/Java-Application)

Here should go questions about transforming XML with XSLT and FOP.
Toralion
Posts: 4
Joined: Fri Dec 02, 2005 5:55 pm
Location: Cologne
Contact:

Differences calling Saxon8B (outof Oxygen/Java-Application)

Post by Toralion » Mon Oct 23, 2006 7:08 pm

Hello,
I try to convert xml to rtf and have problems converting unicode characters to ansi (rtf allows only ansi chars).
For that purpose I have to convert any char above codepoint 255 into its numeric value (string-to-codepoints) and write it (under the rules of rtf) into my target document.

The problem is, when I use Saxon8B out of Oxygen everything works fine, but if I call the same template out of my Java-Application also using Saxon8B, umlauts are not translated correct.

E.g.
With Saxon out of Oxygen Ä remains "Ä" (Decimal code points 196)
With Saxon out of my Application Ä becomes "Ä" (Decimal code points 195 8222)

Are there any 'special' settings or parameters set for the saxon engine in oxygen that could be accountable for that differences?

Any idea? I would be thankful for any suggestion.

Toralion
Posts: 4
Joined: Fri Dec 02, 2005 5:55 pm
Location: Cologne
Contact:

Post by Toralion » Tue Oct 24, 2006 10:31 pm

Ha!
I fixed the problem today.

The problem was the way I read the xml.
When I use StreamSource to read the xmlFile I get the mentioned problem.
--> Source source = new StreamSource(xmlFile);

The Solution was to use a SAXSource to read the xml
--> Source source = new SaxSource(xmlFile);

So long,
Toralion

george
Site Admin
Posts: 2100
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Wed Oct 25, 2006 8:59 am

That was an encoding problem. When you use StreamSource you will get the default platform encoding. When you use SaxSource the encoding will be detected from the file.

Best Regards,
George

Toralion
Posts: 4
Joined: Fri Dec 02, 2005 5:55 pm
Location: Cologne
Contact:

Post by Toralion » Wed Oct 25, 2006 10:30 am

george wrote:That was an encoding problem. When you use StreamSource you will get the default platform encoding. When you use SaxSource the encoding will be detected from the file.

Best Regards,
George
Ah yes, I kind of thought that also I expected that the encoding would be the one I safed the file with... never mind. It works! 8)

Thanks for the info George!

Best Regards,
Toralion

Post Reply