note 111652 added to function.iconv
| From: | DanielKlein | Date: | Wed, 13 Mar 2013 00:17:26 +0000 |
| Subject: | note 111652 added to function.iconv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194049@lists.php.net to get a copy of this message | ||
You can use 'CP1252' instead of 'Windows-1252':
<?php
// These two lines are equivalent
$result = iconv('Windows-1252', 'UTF-8', $string);
$result = iconv('CP1252', 'UTF-8', $string);
?>
Note: The following code points are not valid in CP1252 and will cause errors.
129 (0x81)
141 (0x8D)
143 (0x8F)
144 (0x90)
157 (0x9D)
Use the following instead:
<?php
// Remove invalid code points, convert everything else
$result = iconv('CP1252', 'UTF-8//IGNORE', $string);
?>
----
Server IP: 69.147.83.199
Probable Submitter: 202.59.29.222
----
Manual Page -- http://php.net/manual/en/function.iconv.php
Edit -- https://master.php.net/note/edit/111652
Del: integrated -- https://master.php.net/note/delete/111652/integrated
Del: useless -- https://master.php.net/note/delete/111652/useless
Del: bad code -- https://master.php.net/note/delete/111652/bad+code
Del: spam -- https://master.php.net/note/delete/111652/spam
Del: non-english -- https://master.php.net/note/delete/111652/non-english
Del: in docs -- https://master.php.net/note/delete/111652/in+docs
Del: other reasons-- https://master.php.net/note/delete/111652
Reject -- https://master.php.net/note/reject/111652
Search -- https://master.php.net/manage/user-notes.php