- /* Only do the slow convert if there are 8-bit characters */
- /* there is no 0x80-0x9F letters in ISO8859-* */
- if ( ! ereg("[\241-\377]", $string) )
- return $string;
-
- $string = preg_replace("/([\201-\237])/e","'&#' . ord('\\1') . ';'",$string);
+ $string = preg_replace_callback("/([\201-\237])/",
+ create_function ('$matches', 'return \'&#\' . ord($matches[1]) . \';\';'),
+ $string);