note 36870 added to function.utf8-decode
| From: | janusz dot s at remove_this dot and_this dot poczta dot fm | Date: | Sat, 25 Oct 2003 12:54:24 +0000 |
| Subject: | note 36870 added to function.utf8-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59279@lists.php.net to get a copy of this message | ||
Here are functions to PROPERLY de/encode Unicode (UTF-8) string to/from ISO-8859-2 (Polish character
set).
Regards,
Janusz
function utf82iso88592($tekscik) {
$tekscik = str_replace("\xC4\x85", "±", $tekscik);
$tekscik = str_replace("\xC4\x84", '¡', $tekscik);
$tekscik = str_replace("\xC4\x87", 'æ', $tekscik);
$tekscik = str_replace("\xC4\x86", 'Æ', $tekscik);
$tekscik = str_replace("\xC4\x99", 'ê', $tekscik);
$tekscik = str_replace("\xC4\x98", 'Ê', $tekscik);
$tekscik = str_replace("\xC5\x82", '³', $tekscik);
$tekscik = str_replace("\xC5\x81", '£', $tekscik);
$tekscik = str_replace("\xC3\xB3", 'ó', $tekscik);
$tekscik = str_replace("\xC3\x93", 'Ó', $tekscik);
$tekscik = str_replace("\xC5\x9B", '¶', $tekscik);
$tekscik = str_replace("\xC5\x9A", '¦', $tekscik);
$tekscik = str_replace("\xC5\xBC", '¼', $tekscik);
$tekscik = str_replace("\xC5\xBB", '¬', $tekscik);
$tekscik = str_replace("\xC5\xBA", '¿', $tekscik);
$tekscik = str_replace("\xC5\xB9", '¯', $tekscik);
return $tekscik;
} // utf82iso88592
function iso885922utf8($tekscik) {
$tekscik = str_replace("±", "\xC4\x85", $tekscik);
$tekscik = str_replace('¡', "\xC4\x84", $tekscik);
$tekscik = str_replace('æ', "\xC4\x87", $tekscik);
$tekscik = str_replace('Æ', "\xC4\x86", $tekscik);
$tekscik = str_replace('ê', "\xC4\x99", $tekscik);
$tekscik = str_replace('Ê', "\xC4\x98", $tekscik);
$tekscik = str_replace('³', "\xC5\x82", $tekscik);
$tekscik = str_replace('£', "\xC5\x81", $tekscik);
$tekscik = str_replace('ó', "\xC3\xB3", $tekscik);
$tekscik = str_replace('Ó', "\xC3\x93", $tekscik);
$tekscik = str_replace('¶', "\xC5\x9B", $tekscik);
$tekscik = str_replace('¦', "\xC5\x9A", $tekscik);
$tekscik = str_replace('¼', "\xC5\xBC", $tekscik);
$tekscik = str_replace('¬', "\xC5\xBB", $tekscik);
$tekscik = str_replace('¿', "\xC5\xBA", $tekscik);
$tekscik = str_replace('¯', "\xC5\xB9", $tekscik);
return $tekscik;
} // iso885922utf8
----
Manual Page -- http://www.php.net/manual/en/function.utf8-decode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36870
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36870&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36870&report=yes
Search -- http://master.php.net/manage/user-notes.php