I have a URL that looks like this (note the “„ symbols):
http://tinklarastis.omnitel.lt/kokius-aptarnavimo-kanalus-klientui-siulo-„omnitel“-1494
I receive it from SimplePie parser, if that matters. Now, if you try going to this specific URL in your browser and copy it from the address bar, you would get a URL that has the non-ASCII symbols percent encoded:
http://tinklarastis.omnitel.lt/kokius-aptarnavimo-kanalus-klientui-siulo-%E2%80%9Eomnitel%E2%80%9C-1494
I am trying to understand how can I mimic the same conversion in PHP. I cannot simply use urlencode() or urlrawencode() as they encode both non-ASCII symbols and reserved symbols, while in my case the reserved symbols (/?&, etc) should stay as they are.
So far I have only seen solutions that involve splitting the URL into pieces between reserved symbols and then using urlencode(), but that feels hackish to me and I hope there's a more elegant solution. I have tried various variations of iconv(), mb_convert_encoding(), yet with no success yet.