At 17:25 18.01.2003, -<[ Rene Brehmer ]>- said:
--------------------[snip]--------------------
>Not sure about quick, but the only way I've found that works with 100%
>guarantee everytime is to take the string and check it character by
>character, and if the ascii value is > 128, simply replace it with the
>ascii value marker...
>
>something like this (untested):
>
>for ($i = 0; $i < strlen($string_to_parse); $i++) {
>  $char = substr($string_to_parse, $i, 1);
>  if (ord($char) > 128) {
>    $output_string .= "&#".ord($char).";";
>  }
>  else {
>    $output_string .= $char;
>  }
>}
>
>You may need to test for value 127 ... not sure if it starts on 0 or 1
>that is...
--------------------[snip]-------------------- 

preg_replace('([\x80-\xff])/e', '&#'.ord('\1').';', $string_to_parse);



-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to