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 ).
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论