Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TXSLPageProducer + UTF-8 XML + UTF-8 XSLT -> UTF-16?

119 views
Skip to first unread message

James Hill

unread,
Jul 30, 2004, 8:24:36 PM7/30/04
to
Hello newsgroup

Delphi 6 Ent with Update 2: I'm using the TXSLPageProducer component to transform an XML document that starts with this declaration:

<?xml version="1.0" encoding="UTF-8"?>

...together with an XSLT file that begins

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="user" exclude-result-prefixes="msxsl user">
<xsl:output method="xml" version="4.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

...and the resulting HTML document always comes out

<?xml version="1.0" encoding="UTF-16"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">

I set the .Encoding property of both XSLPageProducer, and XMLDocument components to 'UTF-8' prior to retrieving the resulting
'Content'. Can anyone explain why this is happening, and what I ought to change to stop it from happening?

Very many thanks in advance


Jeff Rafter

unread,
Jul 30, 2004, 7:59:16 PM7/30/04
to
My guess is that this is happening because Delphi is using string (BSTR)
version of the result of the transformation. MSXSL (which is under the hood)
thinks you want UTF-16 if you want a BSTR. The only way around it is to use
the MSXSL engine directly using an IXSLProcessor or using
transformNodeToObject and passing an IStream. There are some examples of
this in Google Groups.

All the best,

Jeff Rafter
http://jeffrafter.com
Web Hosting Sponsor
http://www.defined.net


James Hill

unread,
Jul 30, 2004, 8:32:03 PM7/30/04
to
Hi Jeff

Many thanks for your VERY prompt reply! Appreciate the advice, I'll go Googling and see what I can find

"Jeff Rafter" <n...@no.com> wrote in message news:410ae0d1$1...@newsgroups.borland.com...

Jeff Rafter

unread,
Jul 31, 2004, 2:15:41 AM7/31/04
to
> Many thanks for your VERY prompt reply! Appreciate the advice, I'll go
Googling and see
> what I can find

Heh, I was posting a response to Eddie's question and saw yours so I tried
to shoot a quick answer. Here are a couple of those links in case you didn't
find them.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&threadm=3c835f47%241_2%40dnews&rnum=2&prev=/groups%3Fq%3DIXSLProcessor%2BDelphi%2BXML%26ie%3DUTF-8%26hl%3Den

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&threadm=3cfe158b%241_2%40dnews&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26safe%3Doff%26q%3DIXSLProcessor%2BDelphi%2BXML%2BJeff%2BRafter

Andrea Raimondi

unread,
Jul 31, 2004, 5:50:30 AM7/31/04
to
James Hill wrote:

> Hello newsgroup
>
> Delphi 6 Ent with Update 2: I'm using the TXSLPageProducer component to transform an XML document that starts with this declaration:

I can't find this component in my D6 Ent.
Where is it located?

Cheers,

Andrew

Andrea Raimondi

unread,
Jul 31, 2004, 8:16:40 AM7/31/04
to
Andrea Raimondi wrote:
> Where is it located?

Err... found :-)

Andrew

James Hill

unread,
Jul 31, 2004, 4:27:10 PM7/31/04
to
Much appreciated Jeff - I separately happened across the first of those two threads, and tried the solution Marrow suggested - which
did the trick, many thanks for hunting the links down for me.


"Jeff Rafter" <n...@no.com> wrote in message news:410b3909$1...@newsgroups.borland.com...

0 new messages