Solved

Smart quotes, special charaters and apostrophe display on web

Posted on 2007-11-28
7
2,121 Views
Last Modified: 2008-11-21
We are having a problem with displaying smart quotes and apostrophes on the web particularly those coming from a database using SQL and coldfusion. Smart quotes are displaying as ý
Apostrophes are displaying as ?
I have tried <meta http-equiv="content-type" content="text/html; charset=utf-8" />
and <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
but neither of these seems to work.
Does anyone have any ideas about how to get these to display correctly.

0
Comment
Question by:cbeverly
7 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 20368038

You can replace them with their non-microsoft equivalent..

Assuming your variable is called "myString"..
This will replace a handful of MS special characters..

<cfscript>
 myString = Replace(myString, chr(8217), chr(39),"ALL");
 myString = Replace(myString, chr(8216), chr(39),"ALL");
 myString = Replace(myString, chr(8220), chr(34),"ALL");
 myString = Replace(myString, chr(8221), chr(34),"ALL");
 myString = Replace(myString, chr(8211), "-","ALL");
</cfscript>

0
 
LVL 13

Expert Comment

by:R7AF
ID: 20368168
This is typically a character encoding problem. Can you tell us what the character encoding is you're using. I've had this situation when the character encoding of a page was UTF-8, data from SQL Server. When using character encoding ISO-8859-1 the problem was gone.

http://htmlhelp.com/tools/validator/charset.html.en
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Open in new window

0
 

Author Comment

by:cbeverly
ID: 20377089
Below is the code snippet I'm using. The first part is the actual code including quotes etc. And following is what actually displays.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</head>
 
 
<body>
“Uncle Jack” Day created this brightly colored scene to show the moment when Adam and Eve were cast out from paradise. An angel flies down to greet the couple with an “eviction notice,” while their bleak future is spelled out in a note on the ground: “Gravy train gone. Adam settled down. Work hard in the barren land . . .” Dey copied the figures from a reproduction of Michelangelo’s Sistine Chapel ceiling, but instead of showing a large, threatening snake as their tempter, he painted a small creature that hides in the grass. (Lynda Hartigan, Made with Passion, 1990) The artist filled the painting with stripes and dabs of pure color to evoke Eden’s lush surroundings.
 
 
</body>
</html>
 
 
This displays as
�Uncle Jack� Day created this brightly colored scene to show the moment when Adam and Eve were cast out from paradise. An angel flies down to greet the couple with an �eviction notice,� while their bleak future is spelled out in a note on the ground: �Gravy train gone. Adam settled down. Work hard in the barren land . . .� Dey copied the figures from a reproduction of Michelangelo�s Sistine Chapel ceiling, but instead of showing a large, threatening snake as their tempter, he painted a small creature that hides in the grass. (Lynda Hartigan, Made with Passion, 1990) The artist filled the painting with stripes and dabs of pure color to evoke Eden�s lush surrounding

Open in new window

0
 

Author Comment

by:cbeverly
ID: 20377098
When I cut and pasted this code there were quotes in the code part but now when I view it, it is inserting strange characters in the code as well as the display
0
 
LVL 2

Expert Comment

by:TenTonJim
ID: 21015007
Make sure your text editor is set to UTF-8 also.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

828 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