[jdom-interest] Unexpected encoding in XMLOutputter
Jason Hunter
jhunter at xquery.com
Wed Sep 29 13:42:04 PDT 2004
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@yourhost.com
>
More information about the jdom-interest
mailing list