java URI#getQuery()无法解码非法字符
为什么
new URI(
null,
null,
"/monitor/123456/data",
"filterParams=[{\"id\":12,\"type\":\"dimension\"}]",
null).getQuery()
返回
filterParams=[%7B%22id%22:12,%22type%22:%22dimension%22%7D]
而不是
"filterParams=[{\"id\":12,\"type\":\"dimension\"}]"
根据URI#getQuery()
文件
The string returned by this method is equal to that returned by the
#getRawQuery()
method except that all sequences of escaped octets are decoded.
是JDK bug还是我在这里缺少一些理解
# 1 楼答案
根据私有方法URI上面的注释。解码它不是一个bug,而是一个功能:)