I encode param as:
$Title="CSVのアップロードに失敗しました。CSV(.zip)ファイルの内容を修正して、再度アップロードをやり直してください。" ;
$Title1=urlencode($Title);
Value of $Title1 is:
"CSV%E3%81%AE%E3%82%A2%E3%83%83%E3%83%97%E3%83%AD%E3%83%BC%E3%83%89%E3%81%AB%E5%A4%B1%E6%95%97%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82CSV%28.zip%29%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E5%86%85%E5%AE%B9%E3%82%92%E4%BF%AE%E6%AD%A3%E3%81%97%E3%81%A6%E3%80%81%E5%86%8D%E5%BA%A6%E3%82%A2%E3%83%83%E3%83%97%E3%83%AD%E3%83%BC%E3%83%89%E3%82%92%E3%82%84%E3%82%8A%E7%9B%B4%E3%81%97%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%E3%80%82"
I send param as:
header("Location:".JRoute::_('index.php?option=com_servicemanager&view=i0702'.'&msg='.$msg1."&Title=".$Title1));
Why on url : value of Title don't encode:
http://localhost:81/joomlandk/index.php/component/servicemanager/?view=i0702&msg=File%20is%20invalid.&Title=CSVă®ă‚¢ăƒƒăƒ—ăƒăƒ¼ăƒ‰ă«å¤±æ•—ă—ă¾ă—ăŸă€‚CSV(.zip)ăƒ•ă‚¡ă‚¤ăƒ«ă®å†…å®¹ă‚’ä¿®æ£ă—ă¦ă€å†åº¦ă‚¢ăƒƒăƒ—ăƒăƒ¼ăƒ‰ă‚’ă‚„ă‚ç›´ă—ă¦ăă ă•ă„。
Can you help me?
One way to properly exchange non-ASCII data is to encode it with base64_encode
. Since Base64 is not completely URL-safe can use urlencode
and urldecode
or you can write a function, which produces URL-safe Base64.
I took it from this answer by joeshmo :
function base64_url_encode($input) {
return strtr(base64_encode($input), '+/=', '-_,');
}
function base64_url_decode($input) {
return base64_decode(strtr($input, '-_,', '+/='));
}
With this helper function you can encode your text:
$Title = "CSVのアップロードに失敗しました。CSV(.zip)ファイルの内容を修正して、再度アップロードをやり直してください。" ;
$encoded_title = base64_url_encode($Title);
To decode it on the other side, simply do this:
$Title = base64_url_decode($_GET['Title']);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.