xsl-list
[Top] [All Lists]

RE: MS IXSLProcessor input encoding

2005-08-22 09:55:34
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-----
Från: Emmanouil Batsis [mailto:Emmanouil(_dot_)Batsis(_at_)eurodyn(_dot_)com]
Skickat: den 22 augusti 2005 14:14
Till: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Ämne: 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--