You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Gus Heck <gu...@olin.edu> on 2004/01/15 20:04:10 UTC

Re: Getting encodings to match (solved)

Solved my own problem... It seems that the jvm was asigning the local 
default encoding to any file it opened (in the entity resolver), and by 
specifying the desired encoding in the InputStreamReader the problem 
goes away.

in otherwords I changed:

            InputStreamReader isr = new InputStreamReader(
            SimulationPanel.class.getResourceAsStream(sys));

to

            InputStreamReader isr = new InputStreamReader(
            SimulationPanel.class.getResourceAsStream(sys),"UTF8");

-Gus

Gus Heck wrote:

> I have a program to which I added a "save as template" feature. The 
> template is an xml file and on my development box everything works 
> great. However upon deployment it seems that something with encodings 
> has been screwed up. I'm working in Java, so I include the DTD in the 
> jar and load it using a custom entity resolver that looks it up on the 
> classpath. It seems that for whatever reason, the DTD file in the jar 
> is getting converted to ISO8859_1 instead of UTF8. The parser will let 
> me leave the encoding delcaration out of the main xml file, but the 
> included DTD apparetly requires it.
>
> My current theory is that the change is happening either when the file 
> goes in and out of CVS, or the encoding is getting changed when Ant 
> builds the jar. Lastly, I noticed that the production machine is 
> running old java (1.4.0) and I am running 1.4.2.
>
> Anyone know which of these is most likely the problem, or have a 
> suggestion for ensuring that the encoding declaration always matches?
>
> - Gus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: Getting encodings to match (solved)

Posted by Paul Libbrecht <pa...@activemath.org>.
The explanation is that any InputStreamReader that doesn't have a 
specified encoded uses the default encoding...


On 15-Jan-04, at 20:04 Uhr, Gus Heck wrote:

>            InputStreamReader isr = new InputStreamReader(
>            SimulationPanel.class.getResourceAsStream(sys));


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org