androidasciiillegalargumentexceptionsslhandshakeexceptionjavax

how to call Web Service with url which contains underscore


in my build.gradle I have some thing like that:

productFlavors {
    dev {
      buildConfigField "String", "BASE_URL", '"https://uat_mobile.xxxxx.com/something/rest/json/"'
    }
}

the problem is when I try to call a WS I have this error which appears because of underscore in url:

javax.net.ssl.SSLHandshakeException: java.lang.IllegalArgumentException: Invalid input to toASCII: uat_mobile.xxxxx.com

What is the workaround to this problem please ?

In advance thank you,


Solution

  • I have faced this issue at my organization, they used underscore "_" for sub-domains, I did a workaround for it you can try the following: