note 71087 deleted from function.str-replace by philip
| From: | philip@php.net | Date: | Wed, 07 Oct 2009 08:04:39 +0000 |
| Subject: | note 71087 deleted from function.str-replace by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161461@lists.php.net to get a copy of this message | ||
Note Submitter: Ota L.
----
This simple function may be usefull to convert czech text from cp-1250 encoding to iso-8859-2
(convert S, T and Z with caron).
I use it because mbstring does not support windows-1250 (i.e. mb_convert_encoding(win2iso($text),
"utf-8", "iso-8859-2");).
<?php
function win2iso($text)
{
$win = array ("\x9A", "\x9D", "\x9E", "\x8A",
"\x8D", "\x8E");
$iso = array ("\xB9", "\xBB", "\xBE", "\xA9",
"\xAB", "\xAE");
return str_replace($win, $iso, $text);
}
?>