RE: [xsl] MS IXSLProcessor input encoding

Subject: RE: [xsl] MS IXSLProcessor input encoding
From: "Gabriel K" <gabriel.klappenbach@xxxxxxxxxxxx>
Date: Mon, 22 Aug 2005 18:55:34 +0200
Ok, here it is. I have a COM object that feeds me the XML. So o.document
contains the XML in UTF-8.

' 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

<some irrelevant code>

' output with IXSLProcessor --------------------------
Set template = Server.CreateObject("MSXML2.XSLTemplate.5.0")
template.stylesheet = domXSL
set processor = template.createProcessor()
processor.input = oStream
processor.input = domXML
processor.output = Response
processor.transform()


The problem is that processor.input reads o.document as an ISO-8859-1
document, instead of UTF-8.
The XML-file has declared UTF-8 and is indeed UTF-8 encoded.


/Gabriel



> -----Ursprungligt meddelande-----
> Fren: Emmanouil Batsis [mailto:Emmanouil.Batsis@xxxxxxxxxxx]
> Skickat: den 22 augusti 2005 14:14
> Till: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Dmne: Re: [xsl] MS IXSLProcessor input encoding
>
> Gabriel K wrote:
>
> >After some investigation I have come to the conclusion that IXSLProcessor
> >always reads it input in ISO-8859-1 (it could also be windows 1252),
> >regardless of any declarations in ado Stream, XML-file or Byte Order
> Mark.
> >
> >Does anyone agree or disagree with that?
> >
> >
>
> The XML parser is responsible for that. If your XML file has a proper
> encoding, the parser should be able to read it properly if that belongs
> to the mandatory encodings (UTF-8 for example, also the default). I am
> sure ppl will have some advice if you demonstrate the code you use to
> read the XML, but in general this is irrelevant to XSL.
>
> hth,
>
> Manos

Current Thread