Jump to content

Single quotes and double quotes showing as ? on web page


jwhite68

Recommended Posts

I have an issue with quotes showing as question marks on my webpage. I am sure its a UTF-8 related issue, but some of the facts surrounding the issue confuse me.

 

The database is MySQL and stores the text as UTF-8.

The PHP script simply takes the data from the database to a string:

 

$desc = $info['description'];

 

And the text itself, is in a HTML string in the database as:

 

<P class=MsoNormal style=MARGIN: 0in 0in 0pt>The Golfers will enjoy their favorite sport on the Golf course only 5 min drive from “The Vineyards”.</P>

 

I am pretty sure that the original source was MS Word, and that the double quotes, in this example, are the special quotes from Word and not the ASCII quotes.

 

When the webpage displays, it displays with the Unicode encoding.

 

So, database is UTF-8, assignment in PHP is simple assignment without any form of stripping, tag removal etc.  And encoding on webpage is Unicode.  So can anyone suggest why they arent being displayed?

 

In the above example, the latter part of the text shows as ?The Vineyards?

It seems to apply to double quotes for sure, but also to some single quotes, as I have other text that displays as it?s instead of it's.

Link to comment
Share on other sites

It could be an en-dash.  As I said, I am pretty sure the source was a Word document initially - but I dont have access to the source to check this.

 

I did try following the post you suggested, but unfortunately its not resulted in any changes/improvements.

Link to comment
Share on other sites

I did find something in the recommended post.

 

By putting the code:

 

$body = ereg_replace(128, '', $body); // Euro symbol
$body = ereg_replace(133, '...', $body); // ellipses
$body = ereg_replace(8226, '', $body); // double prime
$body = ereg_replace(8216, "'", $body); // left single quote
$body = ereg_replace(145, "'", $body); // left single quote
$body = ereg_replace(8217, "'", $body); // right single quote
$body = ereg_replace(146, "'", $body); // right single quote
$body = ereg_replace(8220, '"', $body); // left double quote
$body = ereg_replace(147, '"', $body); // left double quote
$body = ereg_replace(8221, '"', $body); // right double quote
$body = ereg_replace(148, '"', $body); // right double quote
$body = ereg_replace(8226, "*", $body); // bullet
$body = ereg_replace(149, "*", $body); // bullet
$body = ereg_replace(8211, "-", $body); // en dash
$body = ereg_replace(150, "-", $body); // en dash
$body = ereg_replace(8212, "-", $body); // em dash
$body = ereg_replace(151, "-", $body); // em dash
$body = ereg_replace(8482, '', $body); // trademark
$body = ereg_replace(153, '', $body); // trademark
$body = ereg_replace(169, '', $body); // copyright mark
$body = ereg_replace(174, '', $body); // registration mark

 

in a function, and invoking it to convert any description strring before being output has helped. Its resolved the hyphen, single and double quotes.  But I now see an issue with a bullet point symbol thats showing as a question mark.  Does anyone have a more comprehensive function, like the one above, that covers all situations?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.