[jdom-interest] Unexpected encoding in XMLOutputter
Wolfgang Werner
wwerner at picturesafe.de
Thu Sep 30 04:24:22 PDT 2004
Thanks for the info, with a small change the code now works perfect.
>> ----------------------------------------------------------------------
>> -- ----
>> Document result = <construct a document here>;
>> response.reset();
>> response.setContentType("text/xml");
>> new XMLOutputter( Format.getPrettyFormat().setEncoding( "ISO-8859-1"
>> ) ).output( result, response.getOutputStream() );
>> ----------------------------------------------------------------------
>> -- ----
Great.
Wolfgang
Am 29.09.2004 um 22:42 schrieb Jason Hunter:
> As you can see in the Javadocs on getFormat() it returns a clone for
> various safety reasons, so you need to get it, change it, and then set
> the outputter to the new formatter. Your code doesn't do the set.
>
> -jh-
>
>
> Wolfgang Werner wrote:
>
>> Hi there,
>> my code inside a jsp should give me an ISO-8859-1 encoded stream:
>> ----------------------------------------------------------------------
>> -- ----
>> Document result = <construct a document here>;
>> response.reset();
>> response.setContentType("text/xml");
>> XMLOutputter xout = new XMLOutputter( Format.getPrettyFormat());
>> xout.getFormat().setEncoding( "ISO-8859-1" );
>> // xout.output( result, System.out );
>> xout.output( result, response.getOutputStream() );
>> ----------------------------------------------------------------------
>> -- ----
>> But what I get is always UTF-8 encoded.
>> I know that that representation is from a xml point of view perfectly
>> legal - but I need
>> an ISO-8859-1 encoded result (for customer reasons...)
>> Please let me know if this is the intended behavior or if it's a bug.
>> I'm using jdom 1.0
>> Best regards,
>> Wolfgang
>> _______________________________________________
>> To control your jdom-interest membership:
>> http://www.jdom.org/mailman/options/jdom-interest/
>> youraddr at yourhost.com
>
More information about the jdom-interest
mailing list