How to URLEncode a partial encoded text in Java?
If the following string is what I want to url-encode,
@test123: http://news.yahoo.com/fifa%E6%96%A5%E8%B3%87%E5%8D%83%E8%90%AC-%E5%8A%A9%E6%88%91%E8%B6%B3%E7%90%83%E5%8D%87%E7%B4%9A-185314701.html check out the news.
I tried to url-encode the full string but it st开发者_运维问答ill url-encode the following url-encoded part of the string.
http://news.yahoo.com/fifa%E6%96%A5%E8%B3%87%E5%8D%83%E8%90%AC-%E5%8A%A9%E6%88%91%E8%B6%B3%E7%90%83%E5%8D%87%E7%B4%9A-185314701.html
And it caused the server failed to identify the request.
How should I accomplish this?
Decode it all, and then encode it.
Also, if it is already encoded, why are you trying to encode it again?
The best solution is going to be to better manage where you are getting the different components of your url, and not mixing and matching encoded and unencoded strings. Your post is confusing as well in that the entire url you listed is encoded. That is to say, there are no elements of that url that are not ASCII.
精彩评论