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.

有帮助吗?

解决方案

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

You can use JAVA's URLEncoder to do that.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top