views:

41

answers:

1
+1  A: 

html_entity_decode() perhaps?

in some cases, in character conversion issues in php, it is important to have a locale set. Doesn't matter which, e.g.

setlocale(LC_CTYPE,'en_US.utf8');

But I would advise that any time invested in getting the encoding right from the beginning, without reverting to entities, if at all possible, is worth it.

mvds
Thanks, I've been trying html_entity_decode(). But even with the locale set, it still does not seem to convert entities like ndashAnd yes, my aim now is to remove all these silly characters so entities are needed at all. Unfortunately, I have to work with the data I'm given, and I seem to have hit a brick wall as to how I can correct the encoding. The only solution I can see at the moment is a find and replace.
Leon
maybe you have to install a locale or something, because om my mac (!) it simply works from the commandline: `mac:~$ php \n<?php print html_entity_decode("–",ENT_COMPAT,"UTF-8"); ?> \n –` (sorry for lack of formatting, \n=newline) debian stock lenny: same.
mvds
If you want to get rid of them alltogether, use iconv and convert from UTF-8 to ASCII//TRANSLIT or ASCII//IGNORE or something like that.
mvds