busboy — 2012-04-28T15:00:39-04:00 — #1
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.
rubble — 2012-04-28T15:13:12-04:00 — #2
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 '
busboy — 2012-04-29T10:08:54-04:00 — #3
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?
rubble — 2012-04-29T10:44:46-04:00 — #4
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
starlion — 2012-04-30T09:18:49-04:00 — #5
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.
busboy — 2012-07-31T21:54:47-04:00 — #6
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);
codeatar — 2012-07-31T22:23:44-04:00 — #7
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: