Solved

wierd output after writing apostrophes to the database

Posted on 2003-12-04
2
222 Views
Last Modified: 2013-12-24
i have an ACTIVEDIT WYSIYIG editor for people to use to put large amounts of HTMLtext and i write this information into a database.  on the website, i pull the information out from the database and the apostrophoes (single quotes) and quotations (double quotes) have become squares like this  after i finish writing to the database.  the information is stored as squares in the database itself.  does anyone know why and how to fix it?

in addition, most people copy the text from a word document or something to that effect and sometimes the quotes get converted to HTML code and sometimes it just stays as the squares.  are these a special code or character?
0
Comment
Question by:happydog234
2 Comments
 
LVL 17

Expert Comment

by:anandkp
ID: 9880040
hmm common problem with most sites !

see if cfqueryparam can help u out in this - as it solves most of the " quotes " related problems.

also try & change the character lang set for ur DB - so it can take in "most" of the special characters & avoid those squares coming up !

with word it may be unavoidable in some cases ...

K'Rgds
Anand
0
 
LVL 1

Accepted Solution

by:
orangachang earned 500 total points
ID: 9905370
I've tried to solve this by converting the smart qoutes to regular CHR(34).  I find this happens when users copy & paste from MS-Word.

The following code is from a custom tag I wrote specifically for this:

<cfscript>
data = ReplaceNoCase(data,"&##x93;","&quot;","ALL");
data = ReplaceNoCase(data,"&ldquo;","&quot;","ALL");
data = ReplaceNoCase(data,"&lsquo;","'","ALL");
data = ReplaceNoCase(data,"&##x94;","&quot;","ALL");
data = ReplaceNoCase(data,"&rdquo;","&quot;","ALL");
data = ReplaceNoCase(data,"&rsquo;","'","ALL");
data = ReplaceNoCase(data,"&##x91;","'","ALL");
data = ReplaceNoCase(data,"&##x92;","'","ALL");
data = ReplaceNoCase(data,"&##x96;","-","ALL");
data = ReplaceNoCase(data,"&ndash;","-","ALL");
data = ReplaceNoCase(data,"“","&quot;","ALL");
data = ReplaceNoCase(data,"”","&quot;","ALL");
data = ReplaceNoCase(data,"‘","'","ALL");
data = ReplaceNoCase(data,"’","'","ALL");
data = ReplaceNoCase(data,"–","-","ALL");
</cfscript>
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

20 Experts available now in Live!

Get 1:1 Help Now