XMLHttpRequest.setRequestHeader with non-ASCII strings

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 UTC