I working on a routine that parses a URI. Among obvious cases there is an empty string case. Is the empty string a valid input? What would be an outcome URI of an empty string?
An empty string can’t possibly be a URI. The general URI syntax specifies that at least the scheme
component followed by a :
followed by the hier-part
component (which may be empty) must be present.
But a relative URI reference can be empty. The syntax of relative references specifies that at least the relative-part
component must be present, but it’s allowed to be empty (path-empty
).
An empty relative URI reference is a same-document reference (bold emphasis mine):
The most frequent examples of same-document references are relative references that are empty or include only the number sign ("#") separator followed by a fragment identifier.
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