Wrox Programmer Forums
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2003, 06:37 AM
dkb dkb is offline
Authorized User
 
Join Date: Oct 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default UTF-16

I have produced a web service that extracts xml from a database and transforms is with XSLT and returns another XML document.

The only problem is that the XML file is encoded as UTF-16.

Because if this it will not open in IE.

Why would it do this?, it is even a problem?

Thanks

 
Old November 3rd, 2003, 06:59 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

IE should understand this type of file. It sounds like the xml declarartion has a different encoding than the one actually used. Can you say a little bit more how it is produced?

Joe (MVP - xml)
 
Old November 3rd, 2003, 09:05 AM
dkb dkb is offline
Authorized User
 
Join Date: Oct 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe,

It is the result of a transformation of data from a database (XML) and an XSLT document.

It is called via a client proxy and written to a file.

The web service called to generate the file returns a string, could this be the problem? (although it would have to return a string if the result of the transformation was not well formed anyway)

 
Old November 3rd, 2003, 09:22 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you are using msxml then a transformNode call generates utf-16. Can you show the start of your xslt transform?

Joe (MVP - xml)
 
Old November 3rd, 2003, 09:35 AM
dkb dkb is offline
Authorized User
 
Join Date: Oct 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

start of my sheet is as below:-

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">

<AccountImport>
<xsl:for-each select="//ATTRIBUTES">
<AccountDocument>

<CompanyID><xsl:value-of select="CO_ID"></xsl:value-of></CompanyID>

 
Old November 3rd, 2003, 10:06 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you email the file to my hotmail address I'll have a look, chop it down to a few lines first.

--

Joe
 
Old November 3rd, 2003, 12:36 PM
dkb dkb is offline
Authorized User
 
Join Date: Oct 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Joe,

Before I do, I think the problem could be as discussed in the article:-

http://www.dotnet247.com/247referenc...32/161971.aspx

I am using a StringWriter Variable to hold the result of the transformation.

Apparantly these are always utf-16.....

What do you think?
 
Old November 3rd, 2003, 12:58 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes they are, that is not the problem, IE will read utf-16 but the xml declaration might need to state the encoding as well.

--

Joe
 
Old November 4th, 2003, 06:06 AM
dkb dkb is offline
Authorized User
 
Join Date: Oct 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again Joe,

Joe,

where can I get your hotmail address?

I am using:-

<xsl:output method="xml" encoding="utf-8" indent="yes"></xsl:output>

in the xslt document, it that what you were going to look for?

Thanks

 
Old November 4th, 2003, 07:12 AM
dkb dkb is offline
Authorized User
 
Join Date: Oct 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Joe,

JUST FOUND THIS!!! This has got to be the answer hasn't it? What do you think?

http://msdn.microsoft.com/library/de...ltransform.asp

My only question now is how to I set the encoding on my TextWriter object?

It's declared as follows:-

TextWriter writer = new StringWriter();






Similar Threads
Thread Thread Starter Forum Replies Last Post
encoding="utf-16" Problem francislang XSLT 7 April 10th, 2015 02:23 AM
Chapter 16 Fig 16-11 krsouthern BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 July 8th, 2008 12:11 PM
UTF-8 sebastian Classic ASP Basics 0 March 16th, 2005 08:22 AM
How to use Scriptupload + UTF-8 ? duydp Classic ASP Professional 1 October 20th, 2004 11:31 AM
UTF-8 msxml lpinho XML 4 January 28th, 2004 06:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.