note 71288 added to function.utf8-encode
| From: | sadikkeskin at hotmail dot com | Date: | Tue, 21 Nov 2006 10:49:45 +0000 |
| Subject: | note 71288 added to function.utf8-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119933@lists.php.net to get a copy of this message | ||
i wrote a function to convert encoding utf8 to iso-8859-9. This function is very useful if you want
to use this for ajax.
you can apply same way for other languages.
<?
function str_encode ($string,$to="iso-8859-9",$from="utf8") {
if($to=="iso-8859-9" && $from=="utf8"){
$str_array = array(
chr(196).chr(177) => chr(253),
chr(196).chr(176) => chr(221),
chr(195).chr(182) => chr(246),
chr(195).chr(150) => chr(214),
chr(195).chr(167) => chr(231),
chr(195).chr(135) => chr(199),
chr(197).chr(159) => chr(254),
chr(197).chr(158) => chr(222),
chr(196).chr(159) => chr(240),
chr(196).chr(158) => chr(208),
chr(195).chr(188) => chr(252),
chr(195).chr(156) => chr(220)
);
return str_replace(array_keys($str_array), array_values($str_array), $string);
}
return $string;
}
?>
----
Server IP: 139.179.10.17
Probable Submitter: 81.213.158.12
----
Manual Page -- http://www.php.net/manual/en/function.utf8-encode.php
Edit -- https://master.php.net/note/edit/71288
Del: integrated -- https://master.php.net/note/delete/71288/integrated
Del: useless -- https://master.php.net/note/delete/71288/useless
Del: bad code -- https://master.php.net/note/delete/71288/bad+code
Del: spam -- https://master.php.net/note/delete/71288/spam
Del: non-english -- https://master.php.net/note/delete/71288/non-english
Del: in docs -- https://master.php.net/note/delete/71288/in+docs
Del: other reasons-- https://master.php.net/note/delete/71288
Reject -- https://master.php.net/note/reject/71288
Search -- https://master.php.net/manage/user-notes.php