Edit report at https://bugs.php.net/bug.php?id=61354&edit=1

 ID:                 61354
 Updated by:         larue...@php.net
 Reported by:        hufeng1987 at gmail dot com
-Summary:            htmlentities and htmlspecialchars do not working
                     with  default_charset ini set
+Summary:            htmlentities and htmlspecialchars doesn't respect
                     the default_charset
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            Strings related
 Operating System:   Linux/Windows/
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2012-03-12 03:03:35] hufeng1987 at gmail dot com

Description:
------------
I am using php 5.4, i got a trouble with htmlspecialchars, htmlentities.

php 5.4 default charset is utf-8.

i thought htmlspecialchars, htmlentities may be using utf-8 as default encoding,

but even i configured default_charset in my php.ini , the htmlspecialchars and 
htmlentities still stupid using utf-8.

this is a bad expirence, my project is a little big, htmlspecialchars using 
every where, almost  3 million called.

i had no chance to specified encoding  by hand.


add encoding to each call of htmlspecialchars and htmlentities not possible, it 
is a huge change for me .


for another solution, why not php let htmlspecialchars using encoding by 
php.ini settings?

is it a better way? is it friendly to users?

sorry for my bad english.

Test script:
---------------
<?php
$string = '<pre><p>我是测试</p></pre>';

echo htmlspecialchars($string);
echo htmlspecialchars($string, NULL, 'GB2312');

Expected result:
----------------
htmlspecialchars should using charset defined by php.ini 

default_charset.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61354&edit=1

Reply via email to