|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46794 addslashes() generate mojibake for single byte(Shift_JIS)
Submitted: 2008-12-08 06:29 UTC Modified: 2008-12-08 08:36 UTC
From: sohel62 at yahoo dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.7 OS: Win 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sohel62 at yahoo dot com
New email:
PHP Version: OS:


 [2008-12-08 06:29 UTC] sohel62 at yahoo dot com
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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-08 08:36 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 19:01:30 2024 UTC