473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 4518
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.com.au> wrote in message
news:f9**************************@posting.google.c om...
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******@infinityinfo.com> wrote in message news:<eg**************@TK2MSFTNGP09.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.com.au> wrote in message
news:f9**************************@posting.google.c om...
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!PLEASEtkachenko.com> wrote in message
news:ub**************@tk2msftngp13.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!PLEASEtkachenko.com> wrote in message
news:ub**************@tk2msftngp13.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
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...
1
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 ...
0
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: ...
3
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>"); ...
2
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
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...
16
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...
15
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...
11
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....
7
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:...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.