#44868 [Opn->Fbk]: Replaces UTF-8 symbol with incorrect symbol

From: Date: Mon, 20 Apr 2009 18:18:50 +0000
Subject: #44868 [Opn->Fbk]: Replaces UTF-8 symbol with incorrect symbol
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136039@lists.php.net to get a copy of this message
ID: 44868 Updated by: jani@php.net Reported By: colourmusic at gmail dot com -Status: Open +Status: Feedback Bug Type: mbstring related Operating System: Win XP SP2 PHP Version: 6CVS-2008-04-30 (snap) New Comment: Please try using this CVS snapshot: http://snaps.php.net/php6.0-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2008-04-30 11:45:18] colourmusic at gmail dot com Description: ------------ I parsed url with UTF-8 encoding and noticed that UTF symbol 8 ( &#65304; = EF BC 98 code units) replaces to EF BC 5F code units that are not correct utf symbol. Script didn't generate errors and warnings. Also I noticed that utf symbols from 0 (&#65296;) to 7 (&#65303;) and 9 (&#65305;) parses by parse_url() without any problems. This bug also appears on PHP 5.2.3 and PHP 5.2.5 Reproduce code: --------------- <?php // mb_convert_encoding() provides same result as html_entity_decode() in this example //$url = mb_convert_encoding("https://example.com/?SHAMEI=&#12521;&#12531;&#12489;&#12463;&#12523;&#12540;&#12470;&#12540;&#65304;&#65296;&#12496;&#12531;&amp;SHAMEI_CD=01465,", "utf-8", "html-entities"); $url = html_entity_decode("https://example.com/?SHAMEI=&#12521;&#12531;&#12489;&#12463;&#12523;&#12540;&#12470;&#12540;&#65305;&#65296;&#12496;&#12531;&amp;SHAMEI_CD=01465,",null,"utf-8"); echo "Original URL = $url <br />\n"; $result = parse_url($url); echo print_r($result); ?> Expected result: ---------------- Original URL = https://example.com/?SHAMEI=&#12521;&#12531;&#12489;&#12463;&#12523;&#12540;&#12470;&#12540;80&#12496;&#12531;&SHAMEI_CD=01465, Array ( [scheme] => https [host] => example.com [path] => / [query] => SHAMEI=&#12521;&#12531;&#12489;&#12463;&#12523;&#12540;&#12470;&#12540;80&#12496;&#12531;&SHAMEI_CD=01465, ) Actual result: -------------- Original URL = https://example.com/?SHAMEI=&#12521;&#12531;&#12489;&#12463;&#12523;&#12540;&#12470;&#12540;80&#12496;&#12531;&SHAMEI_CD=01465, Array ( [scheme] => https [host] => example.com [path] => / [query] => &#12521;&#12531;&#12489;&#12463;&#12523;&#12540;&#12470;&#12540;&#65533;_0&#12496;&#12531;&SHAMEI_CD=01465, ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44868&edit=1

« previous php.bugs (#136039) next »