Solved

Smart quotes, special charaters and apostrophe display on web

Posted on 2007-11-28
7
2,115 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

746 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

14 Experts available now in Live!

Get 1:1 Help Now