title: React, querystring.stringify uses wrong encoding, Spring authentication fails. How to change encoding
body: <p>I have problem with Spring security configured to use LDAP for authentication. If username or password contains scandinavian letters (ä, ö, å...) authentication fails. I verified the login succeeds with same credentials using different application with same LDAP, so problem is indeed the encoding. Note that each application use different authentication service, only the LDAP is common with each service.</p>
  
  <p>With the application where login succeeds, using username <code>Asdf123</code> and password <code>Äöasdf123#%&amp;</code> results in the following POST payload sent to applications authentication endpoint</p>
  
  <p><code>username=Asdf123&amp;password=%C4%F6asdf123%23%25%26</code></p>
  
  <p>Now, the application where login fails using same credentials, POST payload looks as following</p>
  
  <p><code>username=Asdf123&amp;password=%C3%84%C3%B6asdf123%23%25%26</code></p>
  
  <p>Here we can see the encoding used is different. How do I know which encoding the working login uses, should I change the encoding in front end or back end for failing application, and how do I change the encoding to match the working application?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I verified the working login uses <em>ascii</em> encoding, where as the failing login uses <em>UTF-8</em>. Now I need to figure out, how to change <code>querystring.stringify</code> to use <em>ascii</em> encoding instead. The documentation states</p>
  
  <blockquote>
    <p>By default, characters requiring percent-encoding within the query string will be encoded as UTF-8. If an alternative encoding is required, then an alternative encodeURIComponent option will need to be specified</p>
  </blockquote>
  
  <p>However, it doesn't mention the available encodeURIComponents. So basically I need a function, which performs ascii encoding for an url components. I figured out javascript provides <code>encodeURIComponent()</code> function out of the box, but again it's the <em>UTF-8</em> encoder. Where I can find, or how can I create the <em>ascii</em> encoder for <code>querystring.stringify</code>?</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>I tried to hardcode the login payload as ascii url encoded string to verify the problem, but unfortunately it didn't solve the problem. I'm seriously running out of ideas.</p>