W3C home > Mailing lists > Public > public-webapi@w3.org > March 2006

XMLHttpRequest.setRequestHeader with non-ASCII strings

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 31 Mar 2006 19:57:48 +1100
To: public-webapi@w3.org
Message-ID: <20060331085748.GA7816@port.mcc.id.au>

Hi everyone.

I asked on #webapi the other day what XHR should do if setRequestHeader
is called with strings that contain non-ASCII characters, since that's
not allowed by HTTP.  Anne suggested I make a test, so here is one
(temporarily, at least):

  http://arc.mcc.id.au:40001/

For each of three cases:

  * a character that exists in ISO-8859-1 but not in ASCII,

  * a character that exists in Unicode plane 0 but not in ASCII, and

  * a character that exists in Unicode plane 1,

the test tries to send a header with such a character in the header
value and another with such a character in the header name.

A summary of the results of my testing:

  Mozilla

    Headers are sent for all three cases of the characters in the
    header values, encoded in UTF-8.  An exception it thrown whenever
    a header is set whose name contains one of the non-ASCII
    character.

  Opera

    Headers are sent for all six cases.  Characters are sent by taking
    their UTF-16 representation and omitting the more significant byte
    of each 16 bit word.
  
  IE

    Headers are sent for all six cases.  Any character that is in
    ISO-8859-1 is sent unchanged.  Characters at or above U+0100 are
    sent as a number of U+003F characters, one for every 16 bit word in
    the character's UTF-16 representation.

  Safari

    Same as IE.

Some text should be included in the spec to say what should be done for
characters outside of ASCII.

Cameron

-- 
 Cameron McCormack			ICQ: 26955922
 cam (at) mcc.id.au			MSN: cam (at) mcc.id.au
 http://mcc.id.au/			JBR: heycam (at) jabber.org
Received on Friday, 31 March 2006 08:57:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:54 GMT