You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Michael Brennan <Mi...@Allegis.com> on 2001/04/05 00:20:44 UTC

Internationalization problem (was RE: cvs commit: xml-axis/java/s rc/org/apache/axis/utils XMLUtils.java)

I'll confess that I'm not up to speed with what the Axis team is doing, but
the below code looks like a problem to me. The
ByteArrayOutputStream.toString method uses the platform default character
encoding. This would, I think, pose problems for internationalized text.

Gotta watch out for those byte array<->String conversion routines.  :-)

>     public static String DocumentToString(Document doc) {
>       try {
>         ByteArrayOutputStream  baos = new ByteArrayOutputStream();
>         XMLSerializer  xs = new XMLSerializer( baos, new 
> OutputFormat() );
>         xs.serialize( (Document) doc );
>         baos.close();
>         return( baos.toString() );
>       }
>       catch( Exception e ) {
>         e.printStackTrace();
>       }
>       return( null );
>     }