|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 20 19:03:41 2023 UTC