Question

I'm using Java's URI class to validate whether or not an IRI is proper. According to the documentation, the URI can spit out an IRI string and it can likewise be constructed from an IRI string. I have a situation where the IRI I'm given contains spaces and the URI is throwing an exception (the IRI in question is http://My IRI Test).

Looking at the RFC, it seems that spaces are not allowed but I would like to confirm.

Was it helpful?

Solution

Spaces are not allowed but you can escape them: http://My%20Iri%20Test

You can use JAVA's URLEncoder to do that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top