I am discovering W3C's IRI (aka RFC3987).
How to convert a phone number (let's say I have the String "+12-3456-789"
) to the IRI format?
Preferably in Java, but any other language is acceptable.
Or am I mistaken, and IRI can not be used for phone numbers? I guess the "tel:" protocol (RFC 3966) makes them acceptable, but not sure how the whole IRI works in practice.
RFC 3987 defines steps for converting URIs to IRIs. The only thing that may need to be changed is the percent-encoding.
Your telephone number has the following URI (according to RFC 3966):
tel:+12-3456-789
As there are no percent-encoded characters, the IRI would be the same:
tel:+12-3456-789
Some parameters can be used in tel
URIs, e.g., phone-context
has to be used for local numbers, which may contain percent-encoded content. Following the linked conversion steps, such an tel
URI might have a different IRI form.