note 82708 deleted from function.mb-convert-encoding by nlopess

From: Date: Sat, 26 Apr 2008 17:42:23 +0000
Subject: note 82708 deleted from function.mb-convert-encoding by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138811@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- 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.

« previous php.notes (#138811) next »