ID: 47433
Comment by: mbeiser at w-commerce dot de
Reported By: mbeiser at w-commerce dot de
Status: Feedback
Bug Type: Strings related
Operating System: Debian Etch
PHP Version: 5.2.8
New Comment:
Ok, I used the newest version oh php and tested with following script:
<?
print ini_get('default_charset')."\n";
print ini_get('mbstring.internal_enconding')."\n";
echo "<pre>\n";
$text = "text with umlauts: ä ü ö\n";
echo "t1: ".$text."\n";
echo "htmlentities : ".htmlentities($text)."\n";
echo "htmlentities iso-8859-1: ".htmlentities($text,
ENT_COMPAT, 'iso-8859-1')."\n";
echo "htmlentities uf8 : ".htmlentities($text,
ENT_COMPAT,'utf-8')."\n";
echo "</pre>\n";
?>
Still got the same Problem. It only works, when I'm defining the third
parameter of the htmlentities-signature the charset explicitly.
I could reproduce this on several servers.
Previous Comments:
------------------------------------------------------------------------
[2009-02-18 21:21:03] [email protected]
Sorry, didn't see the note about 5.2.8 there. Please provide a sane
reproducing script.
------------------------------------------------------------------------
[2009-02-18 07:54:59] mbeiser at w-commerce dot de
Description:
------------
With the PHP Version 5.2.0 there comes a charset-problem concerning the
htmlentities-function. While it has worked under PHP4 (setting up the
parameters using htaccess), we can't manage to use a
htmlentities-function without setting up the charset(UTF-8) with the
third parameter.
This was tested under Debian Etch13, Ubuntu LTS 8.04 with the PHP
Versions 5.2.0 and 5.2.8.
Reproduce code:
---------------
<?php
$text = "Text mit Umlauten: ä ü ö";
echo "htmlentities without exp. charset and
htaccess:".htmlentities($text, ENT_COMPAT)."\n";
echo "htmlentities utf-8 :".htmlentities($text, ENT_COMPAT,
'utf-8')."\n";
?>
Expected result:
----------------
htmlentities without exp. charset and htaccess: Text mit Umlauten: ä
ü ö
htmlentities uf8 : Text mit Umlauten: ä ü ö
Actual result:
--------------
htmlentities without exp. charset and htaccess: Text mit Umlauten: ä
ü ö
htmlentities uf8 : Text mit Umlauten: ä ü ö
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47433&edit=1