Java和RFC 3986 URI编码
有没有一个类可以按照RFC 3986规范对泛型String
进行编码
也就是说:"hello world"
=>"hello%20world"
不是(RFC 1738):"hello+world"
谢谢
你可以在下面搜索框中键入要查询的问题!
有没有一个类可以按照RFC 3986规范对泛型String
进行编码
也就是说:"hello world"
=>"hello%20world"
不是(RFC 1738):"hello+world"
谢谢
# 1 楼答案
解决这个问题:
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/util/UriUtils.html
方法
encodeUri
# 2 楼答案
我不知道有没有。有一个类提供编码,但它将“”改为“+”。但是可以使用String类中的replaceAll方法将“+”转换为所需的值
str.repaceAll(“+”,“%20”)