jde

Blackberry URL encoder

懵懂的女人 提交于 2019-11-30 04:06:11
问题 I need to encode a URL using HTTP GET request in Blackberry. Can any one help me find how do I achieve this. 回答1: Whyt don't you use RIM's URLEncodedPostData? private String encodeUrl(String hsURL) { URLEncodedPostData urlEncoder = new URLEncodedPostData("UTF-8", false); urlEncoder.setData(hsURL); hsURL = urlEncoder.toString(); return hsURL; } 回答2: here you go ;^) public static String URLencode(String s) { if (s!=null) { StringBuffer tmp = new StringBuffer(); int i=0; try { while (true) { int