#22335 [Com]: htmlspecialchars() encodes foriegn chars too!
| From: | mano at cvr dot hu | Date: | Tue, 04 May 2004 23:55:46 +0000 |
| Subject: | #22335 [Com]: htmlspecialchars() encodes foriegn chars too! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59232@lists.php.net to get a copy of this message | ||
ID: 22335
Comment by: mano at cvr dot hu
Reported By: caleb_ownz at yahoo dot com
Status: Bogus
Bug Type: Strings related
Operating System: Windows
PHP Version: 4.3.0
New Comment:
Hi
Yes, I also recognized this problem with the hungarian chars!
I hope that I'll find the solutions around here...
.mano
Previous Comments:
------------------------------------------------------------------------
[2003-02-22 14:27:09] iliaa@php.net
set proper status.
------------------------------------------------------------------------
[2003-02-22 14:26:55] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Works fine here, the error you are seeing sounds like a result of
COPY/PASTE operation from another Win32 application. Win32 has a nasty
tendency to automatically encode special characters into their HTML
enteties.
The example below should demonstrate that htmlspecialchars() works
correctly.
<?php
var_dump(htmlspecialchars("ùìåí"));
?>
------------------------------------------------------------------------
[2003-02-21 06:02:01] caleb_ownz at yahoo dot com
hmm after checking some more research i noticed that this happens only
when the browser encoding != language you are writing.
So if you write in hebrew when the browser is set to encode Western
European you will get something similar to this:
"עברית" although i did solve all these
problems by calling html_entities_decode() but still.. why should
htmlspecialchars() encode anything but the SPECIAL chars, and not
language chars..
ùìåí
becomes
שלום
------------------------------------------------------------------------
[2003-02-20 17:25:17] iliaa@php.net
Could you please supply a simple string with which the problem occures.
------------------------------------------------------------------------
[2003-02-20 13:00:33] caleb_ownz at yahoo dot com
Hello,
The htmlspecialchars() function should only convert SPECIAL chars such
as '&' '"' ''' '<' '>'. (at
least this is what the documentation says)
But this function also seems to convert foriegn language (non-english)
chars too which is what htmlentities() basically does.
I have tested this on Russian and Hebrew!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22335&edit=1