Page 1 of 1

htmlentities() giving strange results...

Posted: Sat Dec 01, 2007 7:11 pm
by abeall
I'm trying to use the htmlentities() function but finding that many characters get very strange results. For instance, the character « does not get converted to simply «, but rather «. Some characters after conversion are even worse -- for instance, the character comes out as â�¹. What's wrong?

Posted: Sat Dec 01, 2007 7:15 pm
by feyd
I would suspect the data you have stored is not simple ascii, but some variant of unicode or other multibyte character set. htmlentities() was built for the ASCII character set.

Posted: Sat Dec 01, 2007 7:21 pm
by abeall
Right on, thanks mate. Changing the third parameter to "UTF-8" has done the trick. Cheers!