Nithesh Merugu Nithesh Merugu - 1 year ago 68
HTTP Question

When I'm using URLEncoder for Http GET Request I'm getting proper URL but when I push that code to live or on server I'm getting error

When I'm using

URLEncoder
for Http GET Request I'm getting proper URL but when I push that code to live or on server I'm getting error.

The reason is in live or server more than 3 spaces are converted into
%09
ie. 5 spaces become
+++%09


hmMailDetails.put("content", URLEncoder.encode(sContent.trim(),"UTF-8"));

Answer Source

Just i have replaced the %09 with an %20........ String cont = URLEncoder.encode(sContent.trim(),"UTF-8"); hmMailDetails.put("content",cont.replace("+", "%20").replace("%09", "%20"));

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download