Here is the page where the problem exists:
Here is the code that I am currently using to make the text presentable:
$testimonialText = ereg_replace(10,"<br />",$testimonialText);$testimonialText = ereg_replace(34,"'",$testimonialText);
$testimonialText = htmlentities($testimonialText, ENT_QUOTES);
Can someone point out what I'm missing? The apostrophe used in the testimonial is displayed as a little icon.
That is probably the character encoding you are using. Either find the right character encoding or replace the ' with & # 3 9 ;
Remove the spaces as this page renders the text as a '
I'm a little unsure how to go about finding the right character encoding. Can you provide a few more details on how I can fix this?
I am not sure which one to use, you could try charset=ISO-8859-1 There are special html charcters as I say; check out: http://www.w3schools.com/tags/ref_entities.asp
Or... instead of replacing the 34 with a quote, you could just replace it with the html code.... your script is currently outputting the quote unencoded.
Ok, I still haven't fixed this, despite taking the advice of some of you and using the html code for an apostrophe. Does anyone else have an idea why I continue to get this stray icon in the place of an apostrophe?
$testimonialText = stripslashes($testimonialText);
$testimonialText = ereg_replace(10,"<br />",$testimonialText);
$testimonialText = ereg_replace(34,"&39;",$testimonialText);
You didn't mention where your source content was coming from. As other mentioned, this probably has something to do with your encoding vs what is coming from your database. In my experience a common cause of this is when content is pasted into a database from Microsoft Word. Word uses these special quote marks that typically don't play nicely with web content. Not saying this is your case specifically, but I thought it might be worth a mention.
You can find some suggestions for cleaning up those quote styles here:
This topic is now closed. New replies are no longer allowed.