Re: [xsl] output encoding problem (second try)

Subject: Re: [xsl] output encoding problem (second try)
From: Jonas Lundberg <my.name.is.hans@xxxxxxxxx>
Date: Fri, 19 Aug 2005 23:52:31 +0200
If I click on "save" on that link, I get an empty .asp page. If I just
view it in the browser, I get to see it in Firefox, which is
completely useless. Why is it useless? Well, I had the same problem as
you have, this week. When looking at a page through Firefox, it looks
fine, but when transforming it through XSL, the Swedish characters
were all wrong. So what I view in Firefox is a transformed file, not
the actual file that you output.

I had a mac character set, which was declared in the HTML file. It did
not help to change the coding declaration in the file. What helped,
was to change the actual encoding, by changing the source of the HTML
file. I suggest that you experiment with changing the actual encoding
in the source of your files. If you know that you can read an ISO
encoding, than I suggest that you use that.

Hans

On 8/19/05, Gabriel K <gabriel.klappenbach@xxxxxxxxxxxx> wrote:
> Yes, I know that the encoding declared is not actually the one used for
EDV.
> That is the given problem. What I want to know is why and how it can be
> fixed.
> Anyway, I have narrowed down the problem now, so perhaps now we can solve
> it.
>
> I'm using the MS IXSLProcessor to do the transformation:
>
> ' 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()
>
> Now. If I use the oStream object as input, I get incorrect encodings (that
> are actually used). It seems that IXSLProcessor reads the adodbStream in
> ISO-8859-1 for some reason.
> The oStream object loads it data directly from a COM-object, that outputs a
> UTF-8 encoded XML file. This XML file seems to be totally correct:
>
http://gabbah.no-ip.org/mirakel/default.asp?ctype=KSP&cdoc=object&cnBookmark
> =ARNEBACKEN&transform=no
> So we assume there is nothing wrong with the input. The link above is a
> direct output of the contents in the oStream variable.
> oStream is created through:
>
> ' 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
>
>
> On the other hand, if I *save the XML to disk* first, then load it from
disk
> (via "domXML.load(Server.MapPath('KSP.xml')) ") and use THAT as input to
the
> IXSLProcessor, the actual encoding is correct, and everything looks fine!
>
> So, it seems to me that the problem is in how IXSLProcessor reads its
input.
> It seems it reads it as ISO-8859-1 when it reads from a Stream but not when
> it reads from a DOMDocument?
> It sounds weird to me, but that's all I can think of. So does anyone know
> more about IXSLProcessor and it's input? I couldn't find any relevant
> settings for it in the documentation.
>
> (Same behaviour in Firefox as in IE. Transformation is done on the server)
>
> /Gabriel
>
>
>
> > -----Ursprungligt meddelande-----
> > Fren: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> > Skickat: den 17 augusti 2005 16:00
> > Till: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Dmne: RE: [xsl] output encoding problem (second try)
> >
> > I don't know if I'm the only regular on this list who generally makes a
> > point of not following links, especially links that cause programs to
> > execute. It's partly general caution, partly that I'm always busy, and
> > partly in a case like this because I don't think following the link will
> > tell me much, since there is so much happening between the output of the
> > XSLT transformation and the pixels that I see in my browser window.
> >
> > What's needed is to look at the input and output files of the
> > transformation
> > directly (with a hex editor) to see:
> >
> > (a) what the declared encoding is (what's in the XML declaration)
> > (b) what the actual encoding is (what hex codes are used to represent E D
> > V)
> >
> > The chances are that the two don't match.
> >
> > Michael Kay
> > http://www.saxonica.com.
> >
> > > -----Original Message-----
> > > From: Gabriel K [mailto:gabriel.klappenbach@xxxxxxxxxxxx]
> > > Sent: 17 August 2005 13:40
> > > To: XSL-list
> > > Subject: [xsl] output encoding problem (second try)
> > >
> > > Hi.
> > > I've been going at this problem for quite some time with no luck.
> > > The problem is one of encodings. My XSL-file transforms an
> > > XML document, and
> > > also reads from another one using document(). For some
> > > reason, these two
> > > never display the characters E D V in them correctly *at the
> > > same time*
> > > (that is, using a specific encoding).
> > >
> > > Below is a link to the output of the transformation. First I
> > > output with
> > > IXSLprocessor, and below that using transformNode().
> > >
> > > http://gabbah.no-ip.org/mirakel/ex.asp?ctype=KSP&cdoc=object&c
> > > nBookmark=ARNE
> > > BACKEN&cpKNP=*
> > >
> > >
> > > As you can see, with IXSLprocessor, the XML read with document() is
> > > displayed correctly, but the main XML is not (the word
> > > 'TrollhC$ttan' is
> > > from the main XML).
> > > With transformNode(), the main XML is displayed correctly, while the
> > > 'imported' one is not. (the word Kabelsk?p is from the imported)
> > >
> > > I'm trying to output everything in UTF-8. The output element
> > > controls the
> > > output encoding only when I use transformNode(), not with
> > > IXSLProcessor.
> > > If you change the encoding used in the browser, either the
> > > main XML or the
> > > imported will not look good!
> > > *OBSERVE* that the transformation is successful if I
> > > transform it in XMLSPY;
> > > all characters display fine. (Then the main XML has been
> > > saved to disk first
> > > and the transformed).
> > > So the problem is when I go via ASP!
> > >
> > > The asp:
> > > http://gabbah.no-ip.org/mirakel/ex.asp.txt
> > > the XSL:
> > > http://gabbah.no-ip.org/mirakel/XSL/PC/KSPex.xsl
> > > the main XML:
> > > http://gabbah.no-ip.org/mirakel/ex.asp?ctype=KSP&cdoc=object&c
> > > nBookmark=ARNE
> > > BACKEN&cpKNP=*&transform=no
> > > the XML imported with document():
> > > http://gabbah.no-ip.org/mirakel/XML/languageDependent.xml
> > > XML-engine:
> > > MSXML3
> > >
> > > Any help with this would be MUCH appreciated.. I've been
> > > struggling with
> > > this for many many days!
> > >
> > > /Gabriel

Current Thread