php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20721 mb_split not splitting ...
Submitted: 2002-11-29 06:20 UTC Modified: 2002-11-29 11:57 UTC
From: jc at mega-bucks dot co dot jp Assigned:
Status: Wont fix Package: mbstring related
PHP Version: 4.2.2 OS: Red Hat Linux 7.2
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jc at mega-bucks dot co dot jp
New email:
PHP Version: OS:

 

 [2002-11-29 06:20 UTC] jc at mega-bucks dot co dot jp
The following code using mb_split() is not working as expected:

$EMAIL = $_POST["email"];
echo "ecoding was ".mb_detect_encoding($EMAIL)."<BR>";
list($a, $b) = mb_split("@", $EMAIL);
echo "a is $a <BR>"; 
echo "b is $b <BR>"; 

OUTPUT:

??????Test.Com
ecoding was EUC-JP

Notice: Undefined offset: 1 in update_email_pw.php on line 38
a is ??????Test.Com
b is 

My internal encodingis set to EUC_JP so I would think that even though I used the ASCII "@" it should work for splitting.

Jc

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-29 11:56 UTC] moriyoshi@php.net
This is not a bug. mb_split() distinguishes full-width and half-width characters. So you should simply parenthesise both characters as a regex character class like

list($a, $b) = mb_split("[@??]", $EMAIL);

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC