php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46256 htmlentities precedes   with Â
Submitted: 2008-10-08 17:00 UTC Modified: 2008-10-08 17:35 UTC
From: jordan dot w dot bradley at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.6 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2008-10-08 17:00 UTC] jordan dot w dot bradley at gmail dot com
Description:
------------
When htmlentities is called, it puts a  before any  

I'm using php-5.2.6-r7 which is the latest in Gentoo's portage tree.

Reproduce code:
---------------
print $_POST['breadcrumb_seperator'].'<br />';
print htmlentities($_POST['breadcrumb_seperator']);

Expected result:
----------------
 >> 
&nbsp;&gt;&gt;&nbsp;

Actual result:
--------------
 >> 
&Acirc;&nbsp;&gt;&gt;&Acirc;&nbsp;

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-08 17:21 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That's because the nbsp is actually encoded in UTF-8. Use the charset parameter to htmlentities() to tell it is us UTF-8.
 [2008-10-08 17:35 UTC] jordan dot w dot bradley at gmail dot com
Ahh I see. Now it works.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Nov 21 19:00:01 2025 UTC