Bug #66254 [Fbk->NoF]: htmlentities does not convert single-byte katakana chars on Shift-JIS

From: Date: Tue, 30 Dec 2014 10:42:10 +0000
Subject: Bug #66254 [Fbk->NoF]: htmlentities does not convert single-byte katakana chars on Shift-JIS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189446@lists.php.net to get a copy of this message
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&lt;br&gt;

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)

« previous php.bugs (#189446) next »