From:             
Operating system: Linux/Windows/
PHP version:      5.4.0
Package:          Strings related
Bug Type:         Bug
Bug description:htmlentities and htmlspecialchars do not working with  
default_charset ini set

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 bug report at https://bugs.php.net/bug.php?id=61354&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61354&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61354&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61354&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61354&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61354&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61354&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61354&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61354&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61354&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61354&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61354&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61354&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61354&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61354&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61354&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61354&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61354&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61354&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61354&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61354&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61354&r=mysqlcfg

Reply via email to