From:             peter at desk dot nl
Operating system: Linux 2.6.5
PHP version:      5.0.0RC3
PHP Bug Type:     Strings related
Bug description:  html_entity_decode misbehaves with UTF-8

Description:
------------
when decoding named entities with html_entity_decode, the resulting
characters are sometimes incorrect. e.g., "€" becomes the UTF-8
representation of the ⁄ entity (fraction slash). not all entities
are incorrectly translated, though. numerical entities work correctly.

tested with both php-5.0.0RC3 and the proposed -RC4 from
snaps.php.net/~andi/

config :

./configure  --with-apxs=/usr/bin/apxs --with-mysql=/usr/local/mysql
--with-gd --enable-safe-mode --with-dom=/usr --enable-ftp --with-zlib
--with-xsl --with-xmlrpc --enable-cli --enable-bcmath --with-iconv
--with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6



Reproduce code:
---------------
// all tests are viewed with browser encoding forced on UTF-8.
<?php
  print html_entity_decode("&euro;",ENT_NOQUOTES,"UTF-8");
  print "<br />";
  print
htmlentities(html_entity_decode("&euro;",ENT_NOQUOTES,"UTF-8"),ENT_NOQUOTES,"UTF-8");
?>

// other test also available on 
// http://fire.desk.nl/decode/index.php
// (just enter &euro; and submit)
// and http://fire.desk.nl/decode/index.phps (source)

Expected result:
----------------
a euro-sign
a euro-sign


Actual result:
--------------
a fractional slash
a euro-sign


-- 
Edit bug report at http://bugs.php.net/?id=29119&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29119&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29119&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29119&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29119&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29119&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29119&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29119&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29119&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29119&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29119&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29119&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29119&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29119&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29119&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29119&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29119&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29119&r=float

Reply via email to