Skip to main content
Known Participant
January 25, 2010
Question

Apostrophe displays incorrectly in SQL database

  • January 25, 2010
  • 1 reply
  • 928 views

MySQL, PHP, Dreamweaver CS4

I have a SQL database that has text fields. If the user enters text that includes an apostrophe (such as the word don't or it's), when the text is displayed on the website, the apostrophe is replaced by a small box. How can I get this character to display correctly? I had contacted Adobe support directly, and they said to post the question on DEVNET. I had posted this question a month ago, but have received no answers. So I am trying again.

This topic has been closed for replies.

1 reply

David_Powers
Inspiring
January 25, 2010

The reason it's displayed as a small box is almost certainly because the user has pasted the text from a program like Word that uses "smart quotes". Depending on how your website is set up, it's likely that the smart quotes are not being encoded correctly.

The first thing to check is that all the pages in your website use UTF-8 encoding. If that doesn't fix the problem, you will need to filter the text before inserting it into the database to replace the smart quotes with ordinary ones. I don't have a handy snippet of code to do that, so see if the encoding sorts out the problem.