note 62131 modified in function.mb-convert-encoding by danbrown

From: Date: Sun, 17 May 2009 16:59:36 +0000
Subject: note 62131 modified in function.mb-convert-encoding by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154922@lists.php.net to get a copy of this message
many people below talk about using <?php mb_convert_encode($s,'HTML-ENTITIES','UTF-8'); ?> to convert non-ascii code into html-readable stuff. Due to my webserver being out of my control, I was unable to set the database character set, and whenever PHP made a copy of my $s variable that it had pulled out of the database, it would convert it to nasty latin1 automatically and not leave it in it's beautiful UTF-8 glory. So [insert korean characters here] turned into ?????. I found myself needing to pass by reference (which of course is deprecated/nonexistent in recent versions of PHP) so instead of <?php mb_convert_encode(&$s,'HTML-ENTITIES','UTF-8'); ?> which worked perfectly until I upgraded, so I had to use <?php call_user_func_array('mb_convert_encoding', array(&$s,'HTML-ENTITIES','UTF-8')); ?> Hope it helps someone else out --was-- many people below talk about using <?php mb_convert_encode($s,'HTML-ENTITIES','UTF-8'); ?> to convert non-ascii code into html-readable stuff. Due to my webserver being out of my control, I was unable to set the database character set, and whenever PHP made a copy of my $s variable that it had pulled out of the database, it would convert it to nasty latin1 automatically and not leave it in it's beautiful UTF-8 glory. So [insert korean characters here] turned into ?????. I found myself needing to pass by reference (which of course is deprecated/nonexistent in recent versions of PHP) so instead of <?php mb_convert_encode(&$s,'HTML-ENTITIES','UTF-8'); ?> which worked perfectly until I upgraded, so I had to use <?php call_user_func_array('mb_convert_encoding', array(&$s,'HTML-ENTITIES','UTF-8')); ?> Hope it helps someone else out http://php.net/manual/en/function.mb-convert-encoding.php

« previous php.notes (#154922) next »