Forum Moderators: coopster
I read in some data, then perform htmlentities($data).
when there is a ’ the data reads as? after reading from db, and after investigating if I look at it before saving in db
it shows as
We�ve
I am stumped, why is this symbol doing this? I thought it was just certain areas causing
since
We’ve --gets the symbo
Crennel's -- shows up just fine
Hope I was clear enough, thanks!
htmlentities($title, ENT_QUOTES, "UTF-8" )
this causes them to show fine on page and leave the symbols...but obviously this causes a insert error when inserting in DB when left showing..
one option is $title = str_replace("’","'",$title);
which works
but I do see other symbols like a long - that do this, so wonder what is best way to handle?
also seem to have problems with “
thanks
thanks
However in the short term you could just stop people entering those characters in there input.
$ok = preg_match(%[\w\.,:;'\?!-]%, $input);
if (!$ok) {
echo "Go back and do it again\n";
}
else {
// put information in database
}
Is there not a way for you to specify that you want a latin-1 encoding on the feed? As that would involve a lot less work.
Have you had a look at the raw feed, not the data in the database? To see if they match.
As there is a possibility that there is some code somewhere that the feed is going through that is altering it. So you are getting your UTF-8 characters where there were none before.
If the feed is UTF-8 encoded then I think that you will just have to put up with them, as they are valid characters for that encoding. However if the feed is latin-1 then they shouldn't be there and you will need to look at what may be causing the problem.