#24835 [Opn->Fbk]: mb_convert_encoding "s" option does not work

From: Date: Fri, 08 Aug 2003 21:17:15 +0000
Subject: #24835 [Opn->Fbk]: mb_convert_encoding "s" option does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45594@lists.php.net to get a copy of this message
ID: 24835 Updated by: moriyoshi@php.net Reported By: jc at mega-bucks dot co dot jp -Status: Open +Status: Feedback Bug Type: mbstring related Operating System: Linux PHP Version: 4.3.3RC1 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2003-07-28 01:41:21] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24835&edit=1

« previous php.bugs (#45594) next »