473,569 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XslTransform/XmlWriter can't encode &#160 in us-ascii or iso-8859-1

My problem starts with wanting "&#160" to actually appear that way in
the output rather than an actual encoded 0xA0 byte in the output
stream. I thought a way to solve this would be to select us-ascii or
iso-8859-1 as the output encoding, and so used this line in the
stylesheet:

<xsl:output method="html" encoding="iso-8859-1"/>

The XslTransform documentation states something like (I can't locate
it now) that the encoding is ignored unless used with a Stream or
TextWriter. I tried to use the XmlTextWriter, but the documentation
for it states:

If the Unicode characters do not fit the specified encoding,
the XmlTextWriter does not escape the Unicode characters into
character entities

What I end up getting is a '?' in place of the &#160. If I change the
encoding to utf-8 or utf-16 it encodes as it should.

Does anyone know of a workaround for this? I believe the processor
should transform even &#x5555 to &#5555 when the encoding cannot
handle the actual 16-bit value.

Regards,

Steven
Nov 12 '05 #1
7 4526
I've confirmed that the behaviour I'm getting is a bug. Does anyone
know of any email address or web form for submitting bug reports for
..NET?

I was inaccurate in my original post. If the output encoding is
iso-8859-1 the behaviour is as expected. It's when the output
encoding is us-ascii when the bug shows itself. In this situation, a
  in the input is encoded as a single '?' character in the
output. In fact any extended ASCII character gets encoded as a '?'.
It's obviously their way of saying "you've tried to output a character
that can't be represented in this character set, so I'll put in a ? so
you can see where it all went wrong". This seems ok for an output
stream that knows nothing else about what is being output. However,
the XslTranslator does know what it is outputting, and what character
set it is outputting to, and how it could correctly represent such
characters in that character set, and thus it should be outputting the
characters "& # 1 6 0 ;".

Regards,

Steven
Nov 12 '05 #2
MSFT guys monitor these newsgroups but if you want to be sure, try these
guys:

http://blogs.msdn.com/DareObasanjo/

http://blogs.msdn.com/mfussell

"Steven Reddie" <sm*@essemer.co m.au> wrote in message
news:f9******** *************** ***@posting.goo gle.com...
I've confirmed that the behaviour I'm getting is a bug. Does anyone
know of any email address or web form for submitting bug reports for
.NET?

I was inaccurate in my original post. If the output encoding is
iso-8859-1 the behaviour is as expected. It's when the output
encoding is us-ascii when the bug shows itself. In this situation, a
  in the input is encoded as a single '?' character in the
output. In fact any extended ASCII character gets encoded as a '?'.
It's obviously their way of saying "you've tried to output a character
that can't be represented in this character set, so I'll put in a ? so
you can see where it all went wrong". This seems ok for an output
stream that knows nothing else about what is being output. However,
the XslTranslator does know what it is outputting, and what character
set it is outputting to, and how it could correctly represent such
characters in that character set, and thus it should be outputting the
characters "& # 1 6 0 ;".

Regards,

Steven

Nov 12 '05 #3
Hi, thank you for the references.

Regards,

Steven

"Jiho Han" <ji******@infin ityinfo.com> wrote in message news:<eg******* *******@TK2MSFT NGP09.phx.gbl>. ..
MSFT guys monitor these newsgroups but if you want to be sure, try these
guys:

http://blogs.msdn.com/DareObasanjo/

http://blogs.msdn.com/mfussell

"Steven Reddie" <sm*@essemer.co m.au> wrote in message
news:f9******** *************** ***@posting.goo gle.com...
I've confirmed that the behaviour I'm getting is a bug. Does anyone
know of any email address or web form for submitting bug reports for
.NET?

Nov 12 '05 #4
Steven Reddie wrote:
stream that knows nothing else about what is being output. However,
the XslTranslator does know what it is outputting, and what character
set it is outputting to,


That's not generally true. When transforming to XmlReader or XmlWriter,
xsl:output instruction is irrelevant and is ignored altogether (that's
ok according to XSLT spec). When transforming to TextWriter, its
encoding is used instead, so encoding attribute of xsl:output
instruction is ignored too.
The only situation when XslTransform class is fully in control over
output serialization is when transforming is done to Stream.

PS. But not outputting character references is still a bug IMO. Btw,
this can be easily worked around by writing custom XmlWriter, which can
take care of these characters.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #5
Steven Reddie wrote:
stream that knows nothing else about what is being output. However,
the XslTranslator does know what it is outputting, and what character
set it is outputting to,


That's not generally true. When transforming to XmlReader or XmlWriter,
xsl:output instruction is irrelevant and is ignored altogether (that's
ok according to XSLT spec). When transforming to TextWriter, its
encoding is used instead, so encoding attribute of xsl:output
instruction is ignored too.
The only situation when XslTransform class is fully in control over
output serialization is when transforming is done to Stream.

PS. But not outputting character references is still a bug IMO. Btw,
this can be easily worked around by writing custom XmlWriter, which can
take care of these characters.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #6
I've got a similar problem in that I can't stop the XmlTextWriter changing
'>' to &gt; even when it's in an xsl:text element with
disable-output-escaping set true.

Any idea?

Paul

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message
news:ub******** ******@tk2msftn gp13.phx.gbl...
Steven Reddie wrote:
stream that knows nothing else about what is being output. However,
the XslTranslator does know what it is outputting, and what character
set it is outputting to,


That's not generally true. When transforming to XmlReader or XmlWriter,
xsl:output instruction is irrelevant and is ignored altogether (that's
ok according to XSLT spec). When transforming to TextWriter, its
encoding is used instead, so encoding attribute of xsl:output
instruction is ignored too.
The only situation when XslTransform class is fully in control over
output serialization is when transforming is done to Stream.

PS. But not outputting character references is still a bug IMO. Btw,
this can be easily worked around by writing custom XmlWriter, which can
take care of these characters.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #7
I've got a similar problem in that I can't stop the XmlTextWriter changing
'>' to &gt; even when it's in an xsl:text element with
disable-output-escaping set true.

Any idea?

Paul

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message
news:ub******** ******@tk2msftn gp13.phx.gbl...
Steven Reddie wrote:
stream that knows nothing else about what is being output. However,
the XslTranslator does know what it is outputting, and what character
set it is outputting to,


That's not generally true. When transforming to XmlReader or XmlWriter,
xsl:output instruction is irrelevant and is ignored altogether (that's
ok according to XSLT spec). When transforming to TextWriter, its
encoding is used instead, so encoding attribute of xsl:output
instruction is ignored too.
The only situation when XslTransform class is fully in control over
output serialization is when transforming is done to Stream.

PS. But not outputting character references is still a bug IMO. Btw,
this can be easily worked around by writing custom XmlWriter, which can
take care of these characters.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
8536
by: Collin VanDyck | last post by:
I have a basic understanding of this, so forgive me if I am overly simplistic in my explanation of my problem.. I am trying to get a Java/Xalan transform to pass through a numeric character reference (i.e.  ) and it seems to be converting the character to its UNICODE representation. Take this source XML document: <?xml version="1.0"...
1
2065
by: wharfprada | last post by:
this one is very puzzling to me. everytime i add   to my xsl file it is displayed as ? mark. I changed my encoding from UTF-8 to ISO-8859-1 and was still gettin the same problem. any idea Thank
0
1874
by: James Thurley | last post by:
I have an XmlDocument object, and need to output the   entity from my code. I potentially need to output other similar entities such as £ for the GBP sign. Here is some example code: //----------------- XmlDocument doc = new XmlDocument(); XmlElement testElement = doc.CreateElement("test"); doc.AppendChild(testElement);
3
3766
by: todd | last post by:
Simply trying to load xml into a DOM without the dom converting my escape sequence. **code snippet** XmlDocument xmlDoc = new XmlDocument() ; xmlDoc.LoadXml("<x>hello world</x>"); **results**
2
1342
by: yangxiaoxiang | last post by:
I find there are some conditions I can't get data defined in another class. One condition is: namespace Test { class A { private int aValue; public void method1() { B b=new B;
2
4000
by: Ori | last post by:
Hi, I'm looking for a good way to validate a US phone number and i though using regular expression for this. I want to support 3 different ways to enter a phone number: 1.Local Phone : 888-8899 2.With extension: (310)888-2569 3.With extension + 1 : 1(888)789-2569 Can someone tell me what expression I can us in order to support those
16
11879
by: Mik | last post by:
I apologise if this post seems a little basic, but I am a newbie and have NO access knowledge. I have downloaded the Accounts Ledger from the Microsoft Website. It allows the user to review a report of transactions between a Start & End date. The Tables and forms i believe are UK format "dd/mm/yyyy", However, when I click on "Review...
15
28326
by: iKiLL | last post by:
hi all, I would like to be able to create an umbrella class for all my main global sections but I would still like to keep them all in separate file something like the below but I keep getting an error saying you are not allowed Multiple base classes. /// <summary>
11
1970
by: Ken Fine | last post by:
I am using VS.NET 2008 and like it a lot. One of the very few things I don't like is a bug that seems to spawn literally thousands of   strings, one after the other, on design view changes. Sometimes I will end up with as many as 30,000 of them. I have to do a "Replace" which is slower than I'd like. This is slowing down my work a lot. This...
7
4144
by: tshad | last post by:
Can't seem to get csc.exe to run from my home machine which has asp.net 1.1 installed. I added the path variable and in the command prompt where I am running my make file I am getting the error: 'csc' is not recognized as an internal or external command,operable program or batch file. I added the path of the csc.exe file to the path...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.