解码包含印地语字符的URL

时间:2014-02-20 14:27:35

标签: php codeigniter urldecode

我在CodeIgniter中创建类别slug并在get参数中发送类别名称,并在我的函数中使用以获取类别的名称。类别名称是印地语。

我使用过php解码函数,例如:utf8_decode()urldecode()rawurlencode()。但它没有给我实际的刺痛。

网址:http://www.website.com/category/संस्कृति

public function index($args)
{
    pr($args);
    $utf_urldecode = utf8_decode(urldecode($args));
    pr($utf_urldecode);
    $utf = utf8_decode($args);
    pr($utf);
    $rawurldecode = rawurldecode($args);
    pr($rawurldecode);
    $encode = urlencode($args);
    pr($encode);
    $dencode = urldecode($args);
    pr($dencode);
    die();
}

我从每个函数得到的输出:

%E0%A4%B8%E0%A4%82%E0%A4%B8%E0%A5%8D%E0%A4%95%E0%A5%83%E0%A4%A4%E0%A4%BF

????????

%E0%A4%B8%E0%A4%82%E0%A4%B8%E0%A5%8D%E0%A4%95%E0%A5%83%E0%A4%A4%E0%A4%BF

संसà¥à¤•à¥ƒà¤¤à¤¿

%25E0%25A4%25B8%25E0%25A4%2582%25E0%25A4%25B8%25E0%25A5%258D%25E0%25A4%2595%25E0%25A5%2583%25E0%25A4%25A4%25E0%25A4%25BF

संसà¥à¤•à¥ƒà¤¤à¤¿

1 个答案:

答案 0 :(得分:1)

也许rawurldecode()会有帮助吗?

正如here所写,它有效。