title: Some questions on character encoding in http request from JavaScript to Java
body: <p>I found some corrupted string data in our database (Sybase ASE 15.7) that would suggest a wrong encoding was inserted (the data was truncated at 1260 characters even though the field is VARCHAR(2000))</p>
  
  <p>The data was being sent like this:</p>
  
  <pre><code>$http({
    method: 'POST',
    url: constructUrl(url),
    headers: {"Content-Type": "application/x-www-form-urlencoded"},
    data: data
  })...
  </code></pre>
  
  <p>The data was text data, all using English characters and numbers, in standard JSON format, sent from China via Chrome browser to a DB in London. </p>
  
  <p>Is it possible that in China the default character set in Chrome is something other than UTF-8 (say UTF-16)?</p>
  
  <p>If so, would it help if I change the header to</p>
  
  <pre><code>headers: {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"},
  </code></pre>
  
  <p>(adding the UTF-8), or is that the default anyway?</p>
  
  <p>The application has other requests as well, with content type = application/text. Would appending the charset=UTF-8 help there as well?</p>