[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: UTF-16 -> UTF-8

  • From: Bob DuCharme <bob@u...>
  • To: "Ollikainen, Jari" <Jari.Ollikainen@q...>,xml-dev <xml-dev@l...>
  • Date: Tue, 26 Jun 2001 13:51:26 -0400

utf 16 utf 8
> I have a problem where my DB is stored as UTF-16 but as I'm using
asp-pages
> I need to change charset code to UTF-8. How can I do this? Using XSLT or
> what?

It's pretty simple in XSLT; just set the encoding attribute of the
xsl:output element. Below is an identity stylesheet that writes its output
as UTF-8. Keep in mind that not all XSLT processors can write to all
encodings, but they are supposed to give you an error message if they can't
handle the setting of the encoding attribute. According to the XSLT Rec,
they all have to "respect values of UTF-8 and UTF-16," but not all can
handle UTF-16.

(In general, the XSL-list at http://www.mulberrytech.com/xsl/xsl-list/ is
the place where XSLT questions will get the quickest answers.)

Bob DuCharme            www.snee.com/bob             <bob@
snee.com>      see http://www.snee.com/bob/xsltquickly for
info on new book "XSLT Quickly" from Manning Publications.

<!-- ~~~~~~~~~~~~~~~~~~~~~ -->

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      version="1.0">

  <xsl:output encoding="utf-8"/>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  </xsl:stylesheet>



  • References:

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.