php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24835 mb_convert_encoding "s" option does not work
Submitted: 2003-07-28 01:41 UTC Modified: 2003-08-10 17:29 UTC
From: jc at mega-bucks dot co dot jp Assigned:
Status: Closed Package: mbstring related
PHP Version: 4.3.3RC1 OS: Linux
Private report: No CVE-ID: None
 [2003-07-28 01:41 UTC] jc at mega-bucks dot co dot jp
Description:
------------
The s option in mb_convert_encoding should convert zen-kaku spaces to han-kaku spaces, this does not work.

Reproduce code:
---------------
Input URI is words=24%BB%FE%B4%D6%A1%A1TIME

echo "<pre>1- $words<BR>";
$words = mb_convert_kana($words, "KV");
echo "2- $words<BR>";
/* this should turn all zen-kaku spaces (%A1%A1) into han-kaku spaces */
$words = mb_convert_kana($words, "sa");
echo "3- $words<BR>";

/*
 * urlencoding the string should turn all han-kaku spaces into + */
$words  = urlencode($words);
$aWords = split("\+",$words);
foreach($aWords as $word) {
  if ($word == "") continue;
  echo "4- $word<BR>";
  $w    = urldecode($word);
  echo "5- $w<BR>";
}


Expected result:
----------------
1- 24&#26178;&#38291;&#12288;TIME
2- 24&#26178;&#38291;&#12288;TIME
3- 24&#26178;&#38291; TIME
4- 24%BB%FE%B4%D6+TIME
5- 24&#26178;&#38291;
5- TIME

Actual result:
--------------
1- 24&#26178;&#38291;&#12288;TIME
2- 24&#26178;&#38291;&#12288;TIME
3- 24&#26178;&#38291;&#12288;TIME
4- 24%BB%FE%B4%D6%A1%A1TIME
5- 24&#26178;&#38291;&#12288;TIME

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-08 16:17 UTC] moriyoshi@php.net
I cannot reproduce the result with the following script.
Like what is mbstring part of your php.ini?

<?
$words=urldecode("24%BB%FE%B4%D6%A1%A1TIME");
mb_internal_encoding("EUC-JP");
echo "1- $words\n";
$words = mb_convert_kana($words, "KV");
echo "2- $words\n";
/* this should turn all zen-kaku spaces (%A1%A1) into han-kaku spaces
*/
$words = mb_convert_kana($words, "sa");
echo "3- $words\n";

/*
 * urlencoding the string should turn all han-kaku spaces into + */
$words  = urlencode($words);
$aWords = split("\+",$words);
foreach($aWords as $word) {
  if ($word == "") continue;
  echo "4- $word\n";
  $w    = urldecode($word);
  echo "5- $w\n";
}
?>

I got:
1- 24[jikan][zenkaku space]TIME
2- 24[jikan][zenkaku space]TIME
3- 24[jikan] TIME
4- 24%BB%FE%B4%D6
5- 24[jikan]
4- TIME
5- TIME

 [2003-08-10 17:29 UTC] jc at mega-bucks dot co dot jp
You are right. I can no longer reproduce this bug either. Please close it.

Sorry about the bogus report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 17:01:30 2024 UTC