#46794 [Opn->Bgs]: addslashes() generate mojibake for single byte(Shift_JIS)

From: Date: Mon, 08 Dec 2008 08:36:53 +0000
Subject: #46794 [Opn->Bgs]: addslashes() generate mojibake for single byte(Shift_JIS)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-131729@lists.php.net to get a copy of this message
ID: 46794 Updated by: derick@php.net Reported By: sohel62 at yahoo dot com -Status: Open +Status: Bogus Bug Type: Output Control Operating System: Win 2000 PHP Version: 5.2.7 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php addslashes only deals with bytes, and has no notion about character sets. Therefore it doesn't know it deals with Shift_JIS and can not escape those with addslashes properly. This is something that will be addressed in PHP 6. Previous Comments: ------------------------------------------------------------------------ [2008-12-08 06:29:01] sohel62 at yahoo dot com Description: ------------ When I tried to use addslashes() function before store data into the database for the following string and the string was encoded as Shift_JIS that was broken. 紹介予定派遣 Except that string there are some other characters also show mojibake too. Best regard Taslim Sohel Reproduce code: --------------- echo addslashes('紹介予定派遣'); Expected result: ---------------- 紹介予\定派遣 Actual result: -------------- 紹介予定派遣 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46794&edit=1

« previous php.bugs (#131729) next »