note 82708 added to function.mb-convert-encoding
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 22 Apr 2008 20:49:12 +0000 |
| Subject: | note 82708 added to function.mb-convert-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138668@lists.php.net to get a copy of this message | ||
I just tried converting from "auto" to UTF-8, and it actually ate an n with a tilde. So I
figured maybe "auto" was wrong, and printed out the results of mb_detect_encoding to see
what it was both before and after conversion.
Before, it was UTF-8; after, it was ASCII.
So I figured maybe I got the parameters backwards, and so set both "from" and
"to" to UTF-8.
It STILL ate the n-tilde, and STILL converted to ASCII.
Code:
echo '<p>' . $val . '</p>';
echo '<p>' . mb_detect_encoding ( $val ) . '</p>';
$val = mb_convert_encoding ( $val, "UTF-8", "UTF-8" );
echo '<p>' . $val . '</p>';
echo '<p>' . mb_detect_encoding ( $val ) . '</p>';
Output:
Miñoso
UTF-8
Mioso
ASCII
Not sure if the tilde-n is going to be eaten by this board or not, so just in case: the first line
of output is "Minoso" with a tilde over the n; the third is "Mioso".
Am I doing something wrong? Why is it converting to ASCII when (I think) I am asking it to convert
to UTF-8?
Thanks.
----
Server IP: 64.71.164.2
Probable Submitter: 24.89.128.146
----
Manual Page -- http://www.php.net/manual/en/function.mb-convert-encoding.php
Edit -- https://master.php.net/note/edit/82708
Del: integrated -- https://master.php.net/note/delete/82708/integrated
Del: useless -- https://master.php.net/note/delete/82708/useless
Del: bad code -- https://master.php.net/note/delete/82708/bad+code
Del: spam -- https://master.php.net/note/delete/82708/spam
Del: non-english -- https://master.php.net/note/delete/82708/non-english
Del: in docs -- https://master.php.net/note/delete/82708/in+docs
Del: other reasons-- https://master.php.net/note/delete/82708
Reject -- https://master.php.net/note/reject/82708
Search -- https://master.php.net/manage/user-notes.php