Solved

Double quotes display unwanted character in HTML

Posted on 2009-05-14
12
1,143 Views
Last Modified: 2013-11-07
We need to save HTML which is result of XSL transformation. We save it as .html file.
When we view that HTML file, double quotes and single quotes come as some unwanted character. Our client try to view this html file on blacmberry and they are seeing unwanted character. I am seeing unwanted character even if i open it in IE 8
I have uploaded .txt file. Save it as HTML file and open it in IE and you will come to know.

Open in new window

454.txt
0
Comment
Question by:dj_user4
  • 6
  • 5
12 Comments
 
LVL 9

Expert Comment

by:tculler
ID: 24387596
HTML/XML have various "special" characters that must be escaped if they're to be actually displayed. For example, if I have the tag

<p>Paragraph with a "double quote"</p>

It'll get all screwy on you because it's not sure what to do with the value "double quote". Instead, you need to change it to

<p>Paragraph with a & quot;double quote& quot;</p>
Remove the spaces between the ampersand and quot though. EE is just retarded in that aspect, and it'll display it incorrectly if I don't put it there.

I'll give a list of various characters that need escaping (again, remove the spaces in the sequence when you use them)

&  =  & amp;
"   =   & quot;
'  =  & apos; (XML only)
<  =  & lt;
>  = & gt;
0
 
LVL 23

Expert Comment

by:Tiggerito
ID: 24396922
Also watch out if your copy/pasting from word.

Word and other editers have alternate quote characters that don't transfer well to xml or html.

Your attachement includes them.

this is an example. I'm not sure how EE will process it

Its All in a Hard Days Work; Forget expense account meals and junkets.
Its All in a Hard Days Work; Forget expense account meals and junkets.

Open in new window

0
 
LVL 23

Expert Comment

by:Tiggerito
ID: 24396944
Badly it seems. In firefox I see all the quotes are shown as hex images.
0
 

Author Comment

by:dj_user4
ID: 24411921
How i can find replace double quote in .net code?

0
 
LVL 23

Expert Comment

by:Tiggerito
ID: 24412261
These are not double quotes in the normal sense ("). They are other characters that in some character sets show up like double quotes.

It can be hard to work out where and how to handle this when there are several stages of transition for the data... word->html text box->database->xml->html

First guess. Have you set your xsl to output in html format?






<xsl:stylesheet ...>

  <xsl:output method="html" />

Open in new window

0
 

Author Comment

by:dj_user4
ID: 24412613
it is double quote character. Save attached file as .txt and view it and you will come to know. When i do XSLT transform on xml and when it returns me result, it contains double quotes("). Now i need to save that output as file. our user need to see that file via URL. SO we are saving it as HTML.

do we have any otehr option?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 23

Expert Comment

by:Tiggerito
ID: 24413274
The text file you uploaded contains characters that look like standard double quotes but they are not. I showed that by pasting from the text file into this forum. If they were double quotes they would have shown up correctly. On my browser they show up as hex images!

Different editors/browsers handle unknown characters in different ways. Somtimes they hide encoding issues. Firefox shows it as an image with hex numbers in it.

It sounds like your editor shows all variants as basic double quotes, therfore hiding the issue from you.

On my text editor they show up as left slanted double quotes, which indicated to me that an editor like word was involved (word uses multiple types of double quotes,  \\, ||, //)
0
 
LVL 23

Expert Comment

by:Tiggerito
ID: 24413343
This may clarify. This is your file in my text editor (notepad++) showing a slanted double and a slanted single quote. These are not the standard quote characters.
Cropper-Capture-1-.jpeg
0
 

Author Comment

by:dj_user4
ID: 24413352
if i display HTML i received after xslt transform on my application, it display correctly but when i save it to HTML file and then if i view it in IE, it shows unknown character. What is the problem & solution?
0
 

Author Comment

by:dj_user4
ID: 24414831
If i have double quotes from MS word, is it possible to display it properly in IE?
0
 

Author Comment

by:dj_user4
ID: 24415307
I came to know that it is smart tag which doesn't displayed properly in HTML. If we have straight quotation from word, then HTML can display it properly. Is there any way to display smart tag quotation in HTML?
0
 
LVL 23

Accepted Solution

by:
Tiggerito earned 500 total points
ID: 24420187
While researching this I found this excelent article

http://www.cs.tut.fi/~jkorpela/www/windows-chars.html

It provides several recomendations and solutions.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now