[whatwg] [WF2] action="mailto:" - encoding spaces

On Tue, 28 Oct 2008 16:01:33 -0400, Ian Hickson <ian at hixie.ch> wrote:

> On Tue, 30 Jan 2007, Shadow2531 wrote:
>>
>> <http://www.whatwg.org/specs/web-forms/current-work/#for-mailto>
>> <http://www.whatwg.org/specs/web-forms/current-work/#x-www-form-urlencoded>
>> (#4)
>>
>> In mailto URIs, %20 represents a space.
>>
>> <form action="mailto:">
>>    <input name="subject" value="1 2">
>>    <input type="submit">
>> </form>
>>
>> If you submit that form, "mailto:?subject=1+2" will be passed to the
>> mail client instead of "mailto:?subject=1%202". This results in "1+2"
>> in the subject field instead of "1 2".
>>
>> Are UAs allowed to use %20 instead so things come out right, or must
>> mail clients decode + to a space? Thunderbird, M2, and Outlook express
>> don't decode +s.
>>
>> RFC2368 is referenced, but it and application/x-www-form-urlencoded
>> that the mailto: form methods are referenced under conflict with each
>> other on whether a space should be encoded to %20 or +.
>
> Fixed in the HTML5 spec. Thanks.

Awesome! Thanks.

Question though.

What about the method="POST" case where the query string is kept?

For example:

<form action="mailto:?subject=1+2" method="POST">
     <input type="text" name="body" value="1+2">
     <input type="text" name="other" value="1 2">
     <input type="submit">
</form>

When submitting that, I expect to see:

mailto:?subject=1%2B2&body=body%3D1%252B2%26other%3D1%25202

submitted to the mail client.

The current POST section seems to say that this would be submitted instead:

mailto:?subject=1+2&body=body%3D1%252B2%26other%3D1+2

In other words, I think spaces in values should be emitted as %20 for POST  
too and in the case there's a query string present in the action attribute  
for POST, any + in the hvalues of the query string should be normalized to  
%2B (to be consistent with a + inside a form control's value that gets  
converted to %2B)

Also, for POST only, if there isn't a subject hvalue specified in the  
action attribute, Firefox will append subject=Form%20Post%20from%20Firefox  
so that "Form Post from Firefox" ends up in the mail client's subject  
field. Do you think "Form Post from UA" should be specified?

-- 
Michael

Received on Wednesday, 29 October 2008 00:35:31 UTC