I wrote a function that will convert all the "problem" characters into their &blah; text. This makes XML feeds valid and eliminates problems with MSWord's smart characters. Feel free to use the function as you see fit (you can even remove the OzTheory.com part.
I remember people talking about things like this awhile ago. Hopefully people find it useful.
PHP Code:
function utf8encode($text=""){
//Compiled by OzTheory.com
$chars=array(
'Ò' => 'Ò',
'Ó' => 'Ó',
'Ô' => 'Ô',
'Õ' => 'Õ',
'Ø' => 'Ø',
'Ù' => 'Ù',
'Ú' => 'Ú',
'Û' => 'Û',
'Ü' => 'Ü',
'ß' => 'ß',
'à' => 'à',
'á' => 'á',
'â' => 'â',
'ã' => 'ã',
'ä' => 'ä',
'å' => 'å',
'æ' => 'æ',
'ç' => 'ç',
'è' => 'è',
'é' => 'é',
'ê' => 'ê',
'ë' => 'ë',
'ì' => 'ì',
'í' => 'í',
'î' => 'î',
'ï' => 'ï',
'ñ' => 'ñ',
'ò' => 'ò',
'ó' => 'ó',
'ô' => 'ô',
'õ' => 'õ',
'ö' => 'ö',
'÷' => '÷',
'ø' => 'ø',
'ù' => 'ù',
'ú' => 'ú',
'û' => 'û',
'ü' => 'ü',
'ÿ' => 'ÿ',
'‚' => '‚',
'ƒ' => 'ƒ',
'„' => '„',
'…' => '…',
'†' => '†',
'‡' => '‡',
'ˆ' => 'ˆ',
'‰' => '‰',
'Œ' => 'Œ',
'–' => '–',
'—' => '—',
'˜' => '˜',
'™' => '™',
'œ' => 'œ',
'Ÿ' => 'Ÿ',
'Ñ' => 'Ñ',
'Ï' => 'Ï',
'Î' => 'Î',
'Í' => 'Í',
'Ì' => 'Ì',
'Ë' => 'Ë',
'Ê' => 'Ê',
'É' => 'É',
'È' => 'È',
'Ç' => 'Ç',
'Æ' => 'Æ',
'Å' => 'Å',
'Ä' => 'Ä',
'Ã' => 'Ã',
'Â' => 'Â',
'Á' => 'Á',
'À' => 'À',
'¿' => '¿',
'µ' => 'µ',
'±' => '±',
'°' => '°',
'®' => '®',
'©' => '©',
'¨' => '¨',
'§' => '§',
'¥' => '¥',
'£' => '£',
'€' => '€',
'¢' => '¢',
'¡' => '¡',
'’' => "'",
'‘' => "'",
'“' => '"',
'”' => '"',
'…' => '...',
"'" => '’'
);
$text=str_replace(array_keys($chars),array_values($chars),$text);
return $text;
}
I may use this on a project I'm working on...
Comment