I have url for audio file that contains some Arabic words and spaces
http://globalmedia.cc/Testing/CMS/main/مسلسلات/مسلسلات كوميدية /يوميات ونيس/الحلقة الثانية.mp3
I tried
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
url = uri.toURL();
the result is // not working
http://globalmedia.cc/Testing/CMS/main/مسلسلات/مسلسلات%20كوميدية%20/يوميات%20ونيس/الحلقة%20الثالثة.mp3
When i but this link in Google Chrome then copy it again it's become
http://globalmedia.cc/Testing/CMS/main/%D9%85%D8%B3%D9%84%D8%B3%D9%84%D8%A7%D8%AA/%D9%85%D8%B3%D9%84%D8%B3%D9%84%D8%A7%D8%AA%20%D9%83%D9%88%D9%85%D9%8A%D8%AF%D9%8A%D8%A9%20/%D9%8A%D9%88%D9%85%D9%8A%D8%A7%D8%AA%20%D9%88%D9%86%D9%8A%D8%B3/%D8%A7%D9%84%D8%AD%D9%84%D9%82%D8%A9%20%D8%A7%D9%84%D8%AB%D8%A7%D9%86%D9%8A%D8%A9.mp3
and this worked for me. I want to do what Google Chrome does by java code? Hint: URL dose not contains parameters, So i want to encode URL as is. Any help!