Bug #66254 [Fbk->NoF]: htmlentities does not convert single-byte katakana chars on Shift-JIS
Edit report at https://bugs.php.net/bug.php?id=66254&edit=1
ID: 66254
Updated by: php-bugs@lists.php.net
Reported by: charles123zelrax456 at yahoo dot com
Summary: htmlentities does not convert single-byte katakana
chars on Shift-JIS
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: mbstring related
Operating System: Linux
PHP Version: 5.5.7RC1
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2014-01-04 20:50:33] yohgaki@php.net
I've tried on my Fedora19's PHP 5.5 and 5.6-dev with SJIS encoded PHP script and got
Original String:
。「」、・ヲァィゥェォャï½ï½®ï½¯
ーアイウエオカキクケコサシスセソï¾ï¾ï¾ï¾ï¾ï¾
ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ã¢ãæ¥æ¬èª
DOUBLEBYTE SINGLE BYTE<br>
Converted String:
。「」、・ヲァィゥェォャï½ï½®ï½¯
ーアイウエオカキクケコサシスセソï¾ï¾ï¾ï¾ï¾ï¾
ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ã¢ãæ¥æ¬èª
DOUBLEBYTE SINGLE BYTE<br>
Since you are using RC, I suppose you built PHP from source. What is your environment?
------------------------------------------------------------------------
[2013-12-10 02:30:46] charles123zelrax456 at yahoo dot com
Description:
------------
Japanese katakana characters can be encoded as single-byte especially when using mobile phones. Most
of the Japanese mobile sites use Shift-JIS encoding. For security purposes, htmlentities is used in
all user inputs. Unfortunately, when single-byte katakana strings encoded in Shift-JIS are passed in
htmlentities, garbage characters are returned.
Test script:
---------------
//make sure that the code as well as the browser settings are encoded also in Shift-JIS
$txt =
"。「」、・ヲァィゥェォャï½ï½®ï½¯
ーアイウエオカキクケコサシスセソï¾ï¾ï¾ï¾ï¾ï¾
ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ã¢ãæ¥æ¬èª
DOUBLEBYTE SINGLE BYTE<br>";
echo "Original String: " . $txt;
$new_txt = htmlentities($txt, ENT_QUOTES, "SJIS");
echo "<br>Converted String: " . $new_txt;
Actual result:
--------------
Original String:
。「」、・ヲァィゥェォャï½ï½®ï½¯
ーアイウエオカキクケコサシスセソï¾ï¾ï¾ï¾ï¾ï¾
ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ï¾ã¢ãæ¥æ¬èª
DOUBLEBYTE SINGLE BYTE
Converted String: ¡¢£¤¥¦§¨©ª«¬Â®¯
°±²³´µ¶·¸¹º»¼½¾¿ÃÃÃÃÃÃ
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃã¢ãæ¥æ¬èª
DOUBLEBYTE SINGLE BYTE<br>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66254&edit=1
Thread (3 messages)