|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-07-22 11:08 UTC] atlantisboydn at yougotmail dot com
Description: ------------ The following script works fine with PHP 4.3.x, but the returned string don't output in HTML-Entities format in PHP 5.0.0 $str = mb_convert_encoding($str, "HTML-ENTITIES","UTF-8"); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 21:00:01 2025 UTC |
$mbstring_cfgs = array( 'zlib.output_compression' => '1', 'zlib.output_compression_level' => '9', 'mbstring.detect_order' => 'UTF-8', 'mbstring.http_input' => 'UTF-8', 'mbstring.http_output' => 'UTF-8', 'mbstring.internal_encoding' => 'UTF-8', 'mbstring.script_encoding' => NULL, 'mbstring.substitute_character' => NULL ); foreach( $mbstring_cfgs as $k => $v ) { ini_set ($k,$v); } $a = @$_POST['txt']; $a = mb_convert_encoding($a, 'UTF-8','SJIS'); $a = mb_convert_encoding($a, 'HTML-ENTITIES','UTF-8'); echo $a; ===================================================== Step One : Converting a SJIS encoded string to UTF-8 string . This step is good , nothing trouble appeared. Step Two : When convert UTF-8 string ( or whatever multi-byte string ) to HTML ENTITIES . PHP 5.0.0 return a wrong string with uncomplete entities and strange characters. I don't face this problem in PHP 4.3.3 RC3.