You MAY encode +
, but you don't have to.
First, we need to agree that mailto
is an example of a generic URI, specified by RFC 2396. (This is what XHTML and HTML 4 use).
Now let us find out the list of reserved characters in RFC 2396.
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
URI splits into absolute and relative:
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
And because scheme mailto:
is specified this is an absolute URI:
absoluteURI = scheme ":" ( hier_part | opaque_part )
And since both patterns for hier_part
start with /
, mailto
is an opaque part.
opaque_part = uric_no_slash *uric
uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
"&" | "=" | "+" | "$" | ","
uric = reserved | unreserved | escaped
So the restriction is that you have to escape /
if it comes to the first character, but after that you can put in reserved characters including +
and @
.
Here's another RFC to support this. In the latest RFCs of mailto scheme published in 2010 called RFC 6068, it says:
Software creating 'mailto'
URIs likewise has to be careful to encode
any reserved characters that are used. HTML forms are one kind of
software that creates 'mailto'
URIs. Current implementations encode
a space as '+'
, but this creates problems because such a '+'
standing
for a space cannot be distinguished from a real '+'
in a 'mailto'
URI. When producing 'mailto'
URIs, all spaces SHOULD be encoded as
%20
, and '+'
characters MAY be encoded as %2B
. Please note that '+'
characters are frequently used as part of an email address to
indicate a subaddress, as for example in <bill+ietf@example.org>
.