RE: [xsl] how to change xml ENCODING dynamicly

Subject: RE: [xsl] how to change xml ENCODING dynamicly
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 27 Mar 2002 09:21:43 -0000
> I use a xsl  and html to let users change the xml's
> data. and then I need submit to a jsp file. but,when I saved, the xml
> is lost something! It lost's  encoding info.... just like this:
>
> <?xml version="1.0"?>

It hasn't lost anything. The output file is encoded using the default output
encoding, UTF-8, and because this is the default, it doesn't need to specify
the encoding in the XML declaration. Any program that reads this XML is
guaranteed to be able to understand UTF-8, which isn't the case for your
original gb2312 encoding.

If you want the output to be in gb2312 (whatever that is), then you can
specify <xsl:output encoding="gb2312"/>, though the XSLT processor is not
guaranteed to support it.

If you want the output to be in the same encoding as the input, there's no
way of specifying this, because the XSLT processor doesn't know what the
input encoding was - only the XML parser knows that.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • [xsl] Re:, (continued)
    • Oleg Tkachenko - Thu, 21 Mar 2002 13:03:27 +0200
    • dragon - Fri, 22 Mar 2002 16:11:53 +0800
      • dragon - Wed, 27 Mar 2002 15:01:05 +0800
        • cutlass - Wed, 27 Mar 2002 08:26:45 -0000
        • Michael Kay - Wed, 27 Mar 2002 09:21:43 -0000 <=
    • Mike Brown - Fri, 22 Mar 2002 01:27:44 -0700 (MST)