php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23449 htmlentities encodes U+2225 and friends incorrectly
Submitted: 2003-05-02 05:21 UTC Modified: 2003-05-02 06:03 UTC
From: brofield at jellycan dot com Assigned: moriyoshi (profile)
Status: Closed Package: Strings related
PHP Version: 4.3.1 OS: windows 2000
Private report: No CVE-ID: None
 [2003-05-02 05:21 UTC] brofield at jellycan dot com
There seems to be a bug in htmlentities() utf-8 conversion. The unicode character U+2225 ?a gets converted into ∩ which is the html entity for the unicode character U+2229 ??.  It should be using ∥ to get the correct symbol.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-02 05:28 UTC] brofield at jellycan dot com
Calling syntax is...

$str = htmlentities( "string containing U+2225", ENT_QUOTES, "utf-8" );

Other incorrect conversions seem to abound...

$str = ctwEncodeUtf8( "∥∦∧∨∩∪∫" );
echo $str.'<br>';
$str = htmlentities( $str, ENT_QUOTES, "utf-8" );
echo $str.'<br>';
echo htmlentities( $str, ENT_QUOTES, 'utf-8' ).'<br>';
exit;

Note: ctwEncodeUtf8 is the same function as found at http://www.zend.com/codex.php?id=838&single=1


Results:

?a&#8742;?ȁɁ?????
???????Ɂ?????
&cap;&cup;&int;?Ɂ?????

The first and second lines should be the same.
 [2003-05-02 05:30 UTC] brofield at jellycan dot com
For some reason the summary got changed. Changed it back.
 [2003-05-02 05:58 UTC] moriyoshi@php.net
Verified.
 [2003-05-02 06:03 UTC] moriyoshi@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

The fix will be in 4.3.2 as well.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 16:01:29 2024 UTC