We've implemented an HTTP authentication connection, encoded in C# with Uri.EscapeDataString()
.
I'm trying to make an identical java test application that does the exact same thing as the C# version, but URLEncoder.encode(string, "UTF-8")
adds additional encoding that isn't quite the same as the C# Uri.EscapeDataString()
function.
What's the equivalent encoding method?
The best way I've found to do this is to use the URL.toURI().toString()
combo:
String uriEncodeVariable = "https://localhost:443";
URL tempURL = new URL(uriEncodeVariable);
String uriResult = tempURL.toURI().toString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With