From: soapergem at gmail dot com
Operating system: Windows
PHP version: 5.4.6
Package: *General Issues
Bug Type: Bug
Bug description:htmlentities returns empty string when it shouldn't
Description:
------------
Doesn't UTF-8 include basic ASCII characters, too? Right now when I try to
encode the copyright symbol (©) using htmlentities (it should encode to
©), it doesn't work. I discovered this since the default encoding for
htmlentities() was switched from ISO-8859-1 to UTF-8 in version 5.4.
I have plenty of places where I rely on basic symbols, such as the
copyright symbol, being encoded properly with htmlentities(). Having to go
in and change all the instances of htmlentities($string) to
htmlentities($string, ENT_COMPAT | ENT_HTML401, 'ISO-8859-1') is not
practical (there are MANY). And with the whole output of the function being
blank, it just makes my scripts completely unusable now.
Help!
Test script:
---------------
<?php
echo htmlentities('©', ENT_COMPAT | ENT_HTML401, 'UTF-8');
?>
Expected result:
----------------
©
Actual result:
--------------
(Nothing - an empty string)
--
Edit bug report at https://bugs.php.net/bug.php?id=62861&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62861&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62861&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62861&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62861&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62861&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62861&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62861&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62861&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62861&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62861&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62861&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62861&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62861&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62861&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62861&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62861&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62861&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62861&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62861&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62861&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62861&r=mysqlcfg