This question already has answers here:
How to set request encoding in Tomcat?
                                
                                    (2个答案)
                                
                        
                                3年前关闭。
            
                    
我正在调用这样的网址:

http://localhost:8080/abc/income?content=%E0%B6%B8%E0%B6%9C%E0%B7%99+%E0%B6%B1%E0%B6%B8+%E0%B6%BD%E0%B6%9A%E0%B7%8A%E0%B6%B8%E0%B7%8F%E0%B6%BD%E0%B7%8A.&SOURCE_PRV=%20HTTP/1.1


在后端(tomcat)中,我正在解码字符串。

但是我得到的内容为“ ???????????????” (几个问号)。

我怎样才能解决这个问题?

最佳答案

java.net.URI类可以提供帮助。在您找到的URL文档中

使用具有多个参数的构造函数之一,例如:

URI uri = new URI(
    "http",
    "search.barnesandnoble.com",
    "/booksearch/first book.pdf",
    null);

URL url = uri.toURL();
//or String request = uri.toString();

10-08 19:26