How to correctly send/receive Unicode in XMLHttpRequest
<p>I am trying to send a string containing the <code>·</code> character to the server using XMLHttpRequest.  I am using the following code to set the content type in my javascript code:</p>

<pre><code>xmlhttpreq.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8")
</code></pre>

<p>Now if I look up what the actual UTF-8 value for <code>·</code>, e.g. using a page like <a href="http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=%C2%B7&amp;mode=char" rel="nofollow">this one</a> or <a href="http://unicodelookup.com/" rel="nofollow">this one</a>, it tells me the value should be 183, or 0xC2 0xB7 as UTF-8 hex bytes.  I see the latter being sent to the server.  The server, when it returns this data encodes it as the string "\u00C2\u00B7", or the literal bytes 0x5C 0x75 0x30 0x30 0x43 0x32 0x5C 0x75 0x30 0x30 0x42 0x37.  The response is passed to <code>JSON.parse(xmlhttpreq.responseText)</code> which converts this to <code>Â·</code>.  Where did the extra <code>Â</code> come from?</p>

<p>The page is UTF-8, the XMLHttpRequest is UTF-8, document.codeset is UTF-8, and the server response is UTF-8.</p>