Bug #67652 [Nab]: htmlentities() return empty string when accented chars are inside the string
| From: | yohgaki@php.net | Date: | Fri, 18 Jul 2014 23:59:33 +0000 |
| Subject: | Bug #67652 [Nab]: htmlentities() return empty string when accented chars are inside the string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186734@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67652&edit=1
ID: 67652
Updated by: yohgaki@php.net
Reported by: andrelisci at gmail dot com
Summary: htmlentities() return empty string when accented
chars are inside the string
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Linux gentoo
PHP Version: 5.5.14
Block user comment: N
Private report: N
New Comment:
Tip: You must validate all input encoding to build secure apps.
Previous Comments:
------------------------------------------------------------------------
[2014-07-18 23:57:32] yohgaki@php.net
You must use correct encoding.
------------------------------------------------------------------------
[2014-07-18 16:28:07] andrelisci at gmail dot com
Adding optional params 'quote_style' and 'charset' solves the problem
print "-->".htmlentities("test
ì",ENT_COMPAT,"ISO-8859-1")."<--\n";
will output
-->test ì<--
------------------------------------------------------------------------
[2014-07-18 15:57:12] andrelisci at gmail dot com
Description:
------------
when accented characters are found inside a string, htmlentities return empty string
this doesn't happen on php old versions
Test script:
---------------
<?php
print "-->".htmlentities("test ì")."<--\n";
print "-->".htmlentities("test à ")."<--\n";
print "-->".htmlentities("test ò")."<--\n";
print "-->".htmlentities("test ù")."<--\n";
print "-->".htmlentities("test è")."<--\n";
print "-->".htmlentities("test é")."<--\n";
?>
Expected result:
----------------
-->test ì<--
-->test à<--
-->test ò<--
-->test ù<--
-->test è<--
-->test é<--
Actual result:
--------------
--><--
--><--
--><--
--><--
--><--
--><--
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67652&edit=1