php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67652 htmlentities() return empty string when accented chars are inside the string
Submitted: 2014-07-18 15:57 UTC Modified: 2014-07-18 23:59 UTC
From: andrelisci at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.5.14 OS: Linux gentoo
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andrelisci at gmail dot com
New email:
PHP Version: OS:

 

 [2014-07-18 15:57 UTC] 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 &igrave;<--
-->test &agrave;<--
-->test &ograve;<--
-->test &ugrave;<--
-->test &egrave;<--
-->test &eacute;<--

Actual result:
--------------
--><--
--><--
--><--
--><--
--><--
--><--

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-18 16:28 UTC] 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 &igrave;<--
 [2014-07-18 23:57 UTC] yohgaki@php.net
-Status: Open +Status: Not a bug
 [2014-07-18 23:57 UTC] yohgaki@php.net
You must use correct encoding.
 [2014-07-18 23:59 UTC] yohgaki@php.net
Tip: You must validate all input encoding to build secure apps.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 08:00:02 2026 UTC