OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 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>