I'm having trouble sending redirects to a servlet with Unicode URLs.
i.e. consider the following url in Turkish
http: //türkçeisimtescil.com
It works if you paste it into the address bar of the browser. However, it is translated into
http://xn--trkeisimtescil-ijb74a.com
your browser upon your request.
Let's say I have the first URL with UTF8 characters, and I get it successfully from the database. I want to redirect a servlet to this URL.
However, when I just do response.sendRedirect(url); (according to the headers), it redirects me to www.t%1frk%e7eisimtescil.com
I even tried response.sendRedirect("http://www.t\u011Frk\u00E7eisimtescil.com"); (inline coding) and the answer was exactly the same.
Perhaps if I get türkçeisimtescil.com in the headers, the browser will convert it to xn--.. format and it will succeed.
I could not understand where the encoding was broken. Any advice is appreciated.
java redirect servlets character-encoding
Ahmet Alp Balkan
source share