Re: Hebrew Directory Names
| From: | Tom Worster | Date: | Fri, 29 May 2009 12:40:01 +0000 |
| Subject: | Re: Hebrew Directory Names | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293342@lists.php.net to get a copy of this message | ||
On 5/28/09 2:06 PM, "Nitsan Bin-Nun" <nitsan@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.