note 78033 added to function.mb-convert-encoding
| From: | volker at machon dot biz | Date: | Tue, 25 Sep 2007 04:05:34 +0000 |
| Subject: | note 78033 added to function.mb-convert-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130768@lists.php.net to get a copy of this message | ||
Hey guys. For everybody who's looking for a function that is converting an iso-string to utf8
or an utf8-string to iso, here's your solution:
public function encodeToUtf8($string) {
return mb_convert_encoding($string, "UTF-8", mb_detect_encoding($string, "UTF-8,
ISO-8859-1, ISO-8859-15", true));
}
public function encodeToIso($string) {
return mb_convert_encoding($string, "ISO-8859-1", mb_detect_encoding($string,
"UTF-8, ISO-8859-1, ISO-8859-15", true));
}
For me these functions are working fine. Give it a try
----
Server IP: 212.124.37.9
Probable Submitter: 89.12.67.3
----
Manual Page -- http://www.php.net/manual/en/function.mb-convert-encoding.php
Edit -- https://master.php.net/note/edit/78033
Del: integrated -- https://master.php.net/note/delete/78033/integrated
Del: useless -- https://master.php.net/note/delete/78033/useless
Del: bad code -- https://master.php.net/note/delete/78033/bad+code
Del: spam -- https://master.php.net/note/delete/78033/spam
Del: non-english -- https://master.php.net/note/delete/78033/non-english
Del: in docs -- https://master.php.net/note/delete/78033/in+docs
Del: other reasons-- https://master.php.net/note/delete/78033
Reject -- https://master.php.net/note/reject/78033
Search -- https://master.php.net/manage/user-notes.php