Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

URLEncoding of URLs with UTF-8 characters

843834Sep 13 2002 — edited Sep 24 2002
Hi,
I'm trying to URL encode a URL with some chinese characters in them. But it isnt working properly.
i.e. When i decode back the encdoed URL (using java.net.URLDEncoder.decode(String) & java.net.URLDecoder.decode(string) respectively), I dont get the same URL back... The chinese characters are lost some how...
I tried writing it to a file instead of printing the out put, but no luck...

input URL=http://down.chinamp3.com/down.php?id=70201&song_name=I%20Will%20Be%20Fine&singer_name=莫文蔚

encoded URL=http%3a//down.chinamp3.com/down.php%3fid%3d70201%26song_name%3dI%2520Will%2520Be%2520Fine%26singer_name%3d%e8%8e%ab%e6%96%87%e8%94%9a

decoded URL=http://down.chinamp3.com/down.php?id=70201&song_name=I%20Will%20Be%20Fine&singer_name=���������������������
Where as the decode URL should be same as the input URL!!!!

I'm completely stuck, Some advice will be highly appreciated!

Regards

Pratim
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2002
Added on Sep 13 2002
5 comments
493 views