Req->Bug #61396 [Opn->Dup]: illogical behavior of the function htmlspecialchars processing line

From: Date: Thu, 15 Mar 2012 05:45:55 +0000
Subject: Req->Bug #61396 [Opn->Dup]: illogical behavior of the function htmlspecialchars processing line
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-168486@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61396&edit=1

 ID:                 61396
 Updated by:         aharvey@php.net
 Reported by:        iblacksmoke at gmail dot com
 Summary:            illogical behavior of the function htmlspecialchars
                     processing line
-Status:             Open
+Status:             Duplicate
-Type:               Feature/Change Request
+Type:               Bug
-Package:            Unicode Engine related
+Package:            Strings related
 Operating System:   doesn't matter
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

Duplicate of bug #61354.


Previous Comments:
------------------------------------------------------------------------
[2012-03-15 05:40:43] iblacksmoke at gmail dot com

I know about the ability to specify the last parameter encoding, but I do not have the ability to
change a lot of scripts already written.

------------------------------------------------------------------------
[2012-03-15 05:27:12] iblacksmoke at gmail dot com

Description:
------------
Function htmlspecialchars does not have compatibility with all scripts in non-unicode charset,
because it uses the default utf-8 encoding instead of the settings(php.ini). It's not a bug,
but not quite logical behavior.

--------------
I'm sorry, I not have opportunity to create patch differences, because I do not have necessary
software on my netbook. I hope, this guide will help you: http://pastebin.com/qCXNWxRh

Test script:
---------------
ini_set('default_charset','windows-1251');
echo htmlspecialchars('<h1>привет мир</h1>');

Expected result:
----------------
&lt;h1&gt;привет мир&lt;/h1&gt;

Actual result:
--------------
null string


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



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


Thread (5 messages)

« previous php.bugs (#168486) next »