Your point is right but these code point does not exist in the subject string so this isn't the issue here. I'm really stuck at this one :S Thank you again for trying to help! On Fri, May 29, 2009 at 2:40 PM, Tom Worster <fsb@xxxxxxxxxx> wrote: > On 5/28/09 2:06 PM, "Nitsan Bin-Nun" <nitsan@xxxxxxxxxxxx> 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. > > > > >