我现在在做一个调用企业QQ接口来发信息的平台,是通过webservice在url传递参数调用接口。。
但是短信内容中含斜杠时会干扰参数的传递,大神教我怎么解决啊?
@GET
@Path("/sendTips/{receivers}/{content}/{windowTitle}/{tipsTitle}/{tipsUrl}")
@Produces ({MediaType.APPLICATION_JSON})
public String sendTips(@PathParam("receivers") String receivers, @PathParam("content") String content,
@PathParam("windowsTitle") String windowsTitle, @PathParam("tipsTitle") String tipsTitle,
@PathParam("tipsUrl") String tipsUrl) throws SystemException;
http://www.w3schools.com/tags/ref_urlencode.asp
参考:
/ ---》 %2F
建议url 转义(URLEncoder类)即可,Java里面有方法
可以使用Unicode 编码啊
用URLEncoder进行编码,然后用再用URLDecoder进行解码 可以规定是UTF-8或者GBK之类的 建议UTF-8