Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨 Um 对 Java 很陌生,我想将 Hello World 编码为 Hello%20World 。但是当我使用 URLEncoder.encode 时,它会将字符串编码为 Hello+World,当我们尝试通过请求将其传递给 IIS 时,它会被视为威胁。如我所述,如何编码?先感谢您。
这仅适用于真实的 URL
URL u = new URL("Hello World"); String path = u.getPath();