iri_to_uri should be idempotent

It isn't but let's fix this later.
Make uri/iri conversion functions idempotent