Re: Comments on draft-duerst-mailto-bis-04.txt, please

On 1/30/08, Mike Brown <mike@skew.org> wrote:
> Michael A. Puls II wrote:
> > So, I think @ in a mailto URI should be reserved and should be encoded
> > as %40.
>
> Hm, no. I'm pretty sure 'reserved' means it falls into the class of characters
> STD66 defines as 'reserved', and "@" does that already. As a member of that
> class, it can only be percent-encoded if it's being used for a purpose other
> than what it's reserved for, if it has a special purpose (which in a mailto
> URI it implicitly does!). Otherwise -- that is, if it's being used for its
> special purpose -- it has to be a literal "@". So it would not be proper to
> say the addr-spec subcomponent-separating "@" ever SHOULD be encoded as "%40".

I see it a different way.

@ is a separator for part of the address. But, addresses don't go in
mailto URIs. Percent-encoded values representing addresses go in
mailto URIs.

Examples:

<script>
var to_address = "email@example.org";
var to_hvalue = encodeURIComponent(to_address);
var uri = "mailto:" + to_hvalue;
alert(uri == "mailto:email%40example.org");
alert(decodeURIComponent(to_hvalue) == to_address);

to_address = '"not@me"@example.org';
to_hvalue = encodeURIComponent(to_address);
uri = "mailto:" + to_hvalue;
alert(uri == "mailto:%22not%40me%22%40example.org");
alert(decodeURIComponent(to_hvalue) == to_address);
</script>

With "mailto:%22not%40me%22@example.org" (from the draft), the mailto
URI spec currently treats that TO hvalue as part percent-encoded and
part addr-spec, when clients really just treat the whole value as a
percent-encoded hvalue. The one @ doesn't become a separator until the
whole hvalue is decoded by the client. While it's in the URI, it's
just and @ and really should be encoded like it is in http query
string hvalues.

The idea is (well should be) that you take your raw value,
percent-encode it (like encodeURIComponent) and put it in a mailto
URI. Then, the client parses the URI and decodes the hvalue to get the
raw value you originally put in. The mailto URI is just a portable way
to specify compose field values.

That's what clients do with URIs and the spec should probably reflect
what clients do.

With that said, you should see why I think all @ in a mailto URI
should be represented as %40 and why @ and %40 in a mailto URI are
equivalent after the hvalue they're in is decoded, FWIW.

At any rate though. The draft should acknowledge how clients treat %40
and @ in mailto URIs.

-- 
Michael

Received on Thursday, 31 January 2008 04:04:48 UTC