I have a URL "ssh: // root: zstackqwe :! @ # @ 172.16.36.184" that contains "@" and ":" in the password. I use java.net.URI to wrap a line, for example:
URI u1 = new URI("ssh://root:zstackqwe:!@#@172.16.36.184/");
System.out.println(u1.getAuthority());
System.out.println(u1.getHost());
output:
root:zstackqwe:!@
null
Part of the permissions is correct, and part of the host returns null. How to handle these special characters?
UPDATE:
The string "ssh: // root: zstackqwe :! @ # @ 172.16.36.184" is an unprocessed string without any encoding passed from the API to my application. I cannot use constructors other than UIR (string). So I'm looking for a way to handle the original string that works with jave.net.URI.
source
share