php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15683 "addslashes" mis-recognises chinese-big5 words with "0xXX 0x5C"
Submitted: 2002-02-23 02:21 UTC Modified: 2002-08-16 10:23 UTC
Votes:4
Avg. Score:4.0 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:4 (100.0%)
From: leochang at blissfountain dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.1.1 OS: ALL
Private report: No CVE-ID: None
 [2002-02-23 02:21 UTC] leochang at blissfountain dot com
"addslashes" and others always mis-recognise and display chinese big5-code words with the character "0xXX 0x5C" by adding slashes into the words....

which makes Traditional Chinese words can never be displayed properly within php...

it's very inconvenient for all traditional Chinese users

Can anyone help?

Someone suggests adding codes of procedure for identifying whether the words are in chinese-big-5 code or not before addslashes and other work...

If that is a practical method, could someone make this "patch" for us chinese linux php users?

If that's not too complicated even for php-developers, could you guys please consider this in your future versions????

Please help!!!!!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-23 02:38 UTC] wandering at cyberdude dot com
magic-quote is another function that creates the problem.... 

Addslashes is a php function that adds a slash in front of ' (single quotes), " (double-quotes), and \ (back slashes) which makes Traditional Chinese words display improperly when parsing the string.

They thought the chinese word to be quoted or something like that...
 [2002-07-07 13:17 UTC] derick@php.net
A feature request for the mbstring extension.

Derick
 [2002-07-10 06:25 UTC] yohgaki@php.net
As mbstring manual mentions, use EUC-TW or UTF-8 if you need to get it working. 

 [2002-08-16 04:02 UTC] ksmeng_1999 at yahoo dot com
to properly escape chinese big5 character with "0xXX 0x5C", u may try this function. this tested with chinese character xu3 and gong1. if it doesnt work wif others, pls let me know. TQ

function addslashes2($string)
{
	$str=ereg_replace("([^\xA1-\xFE])[\x5c]","\\1\\\\",$string);
	$str=ereg_replace("'", "\\'", $str);
	$str=ereg_replace("\"", "\\\"", $str);
	return $str;
}
 [2002-08-16 10:23 UTC] kalowsky@php.net
From my understanding the mbstring handles this, and if not the script added below by ks_meng should do the trick.  Marking this as closed, but if you feel this is insufficenet please reopen the bug.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Oct 19 10:01:26 2019 UTC