开发者

How to convert from σκ to σκ?

I need to put greek letters into a URL, for example: www.example.com?id=σκ 开发者_Python百科I have the string σκ like this: σκ What function can I use in PHP to convert from σκ to σκ?

Thank you, phpheini


Use html_entity_decode AND urlencode - because you shouldn't put special greek characters to the url.

$str = html_entity_decode('σκ', ENT_NOQUOTES, 'UTF-8');
// $str is 'σκ'
$str = urlencode($str);
// $str is '%CF%83%CE%BA'

$link = 'http://www.example.com?id=' . $str;


try htmlspecialchars_decode ( string $string [, int $quote_style = ENT_COMPAT ] )

Edit: On this site where you genereate the URL(parameter) set rawurlencode ( string $str ). Then the url is encoded. Then you can revert it with rawurldecode ( string $str ).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜