On 5/28/09 2:06 PM, "Nitsan Bin-Nun" <nit...@binnun.co.il> wrote:

> preg_replace("/([\xE0-\xFA])/e","chr(215).chr(ord(\${1})-80)",$s);

...

> The preg_replace() above convert the Hebrew chars into UTF8.

that preg_replace takes a byte string $s and:

- leaves bytes with value 0-127 intact
- converts bytes with value 224-250 to the utf8 multibyte character code of
the corresponding win-1255 character
- produces an invalid utf8 output for all other code points, for which see:
http://en.wikipedia.org/wiki/Windows-1255

so it's a win-1255 to utf-8 converter only so long as you are confident that
code points 128-223 and 251-255 are never in the subject string.

try iconv('CP1255', 'UTF-8', $s) instead.





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

Reply via email to