|
Subject: RE: [xsl] IXSLProcessor - input in UTF-8? From: "Gabriel" <gabriel.klappenbach@xxxxxxxxx> Date: Tue, 13 Sep 2005 17:32:08 +0200 |
I get the XML from a COM-object that I use in an ASP page:
<% @LANGUAGE="VBSCRIPT" %>
<%
option explicit
Response.Expires=-1
'Response.ContentType = "text/html"
' setup XML-server
------------------------------------------------------------------
dim o
set o = Server.CreateObject("MwebbCOM.MwebbCOM.1")
o.httpRemoteUser = Request.ServerVariables("REMOTE_USER")
o.httpRemoteAddr = Request.ServerVariables("REMOTE_ADDR")
o.httpQueryString = Request.QueryString
o.BeginTransaction
' --------------------------------------------------------------------
' setup ADODB Stream -------------------------------------------------
dim oStream
set oStream = createobject("Adodb.Stream")
oStream.Type = 2
oStream.Charset = "UTF-8"
oStream.open
oStream.writeText o.document
oStream.position = 0
' load XML and XSL ---------------------------------------------------
dim domXML, domXSL, processor, template
set domXSL = Server.createObject("MSXML2.FreeThreadedDOMDocument.5.0")
set domXML = Server.createObject("MSXML2.DOMDocument.5.0")
domXSL.load(Server.MapPath("XSL/PC/PC-templates.xsl"))
domXML.load(oStream)
' output with IXSLProcessor ------------------------------------------
Set template = Server.CreateObject("MSXML2.XSLTemplate.5.0")
template.stylesheet = domXSL
set processor = template.createProcessor()
processor.input = domXML
processor.output = Response
processor.transform()
%>
As you can see I put the XML in a stream and then load it into a DOM XML
object. This serves as input to IXSLProcessor.
The xml has the declaration <?xml version="1.0" encoding="UTF-8"?>
What could be non XML aware in my code?
> -----Ursprungligt meddelande-----
> Fren: andrew welch [mailto:andrew.j.welch@xxxxxxxxx]
> Skickat: den 13 september 2005 17:18
> Till: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Dmne: Re: [xsl] IXSLProcessor - input in UTF-8?
>
> On 9/13/05, Gabriel <gabriel.klappenbach@xxxxxxxxx> wrote:
> > The input XML of course defines the encoding as UTF-8, and really is
> encoded
> > in UTF-8, but IXSLProcessor still reads it as ISO-8859-1. So it ignores
> the
> > declaration in the XML file.
> >
> > The transform is taking place server side.
> >
> > So are you saying the IXSProcessor is supposed to be able to read the
> > encoding specified in the XML file?
>
> Yes - If the encoding is specified in the xml prologue in the file
> then the xml parser has to read the file in that encoding - if it
> doesn't then its non-conforming.
>
> You may be doing by accident what I was trying to achieve the other
> day - parse the file in a particular encoding ignoring the encoding
> given in the prolog. How are you reading the XML into the transform?
> If it's in a non-xml aware way then you are likely reading the bytes
> in the platform encoding and then the characters as XML.
>
> In Java this is a FileInputStream -> InputStreamReader. The
> FileInputStream doesn't know about XML and so reads the file in
> whatever encoding you tell it to.
>
> If you post some code someone might know the equivalent in .Net
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] IXSLProcessor - input in , andrew welch | Thread | Re: [xsl] IXSLProcessor - input in , andrew welch |
| [xsl] Keeping a map in my XSL, Kevin L. Cobb | Date | Re: [xsl] IXSLProcessor - input in , andrew welch |
| Month |