title: Why UTF-8 Unicode in address bar vs GET form is difference in C?
body: <p>I've developed a simple web page using C.</p>
  
  <p>I will get the url address values and check them using strtok, strsep.</p>
  
  <pre><code>que=getenv("QUERY_STRING");
  ...
  strcpy(val,strsep(&amp;string,"="));
  printf("%s&lt;br&gt;",val);
  </code></pre>
  
  <hr>
  
  <h3>Browser Result when using <code>&lt;form method="GET"&gt;</code></h3>
  
  <p><strong>E.g:</strong> When you type <code>۱</code> in an input field and press submit, it redirects to <code>http://localhost/api?identifier=%26%231777%3B</code>.</p>
  
  <p>Output of <code>getenv("QUERY_STRING")</code> :</p>
  
  <pre><code>identifier=%26%231777%3B 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/iyrUy.png" alt="Address bar">
  <img src="https://i.stack.imgur.com/pjXkk.png" alt="Browser Output"></p>
  
  <h3>Trying with different values:</h3>
  
  <pre><code>۱   =&gt; %26%231777%3B
  ۲   =&gt; %26%231778%3B
  ۳   =&gt; %26%231779%3B
  ۱۲۳ =&gt; %26%231777%3B%26%231778%3B%26%231779%3B
  </code></pre>
  
  <p>It can easily be fixed using a function in the <strong>DecodeQueryStringC</strong>.</p>
  
  <p>This is written by Max Base.</p>
  
  <p><a href="https://github.com/BaseMax/DecodeQueryStringC" rel="nofollow noreferrer">https://github.com/BaseMax/DecodeQueryStringC</a></p>
  
  <pre><code>decodeUrl(val,val);
  printf("Fix:%s&lt;br&gt;",val);
  </code></pre>
  
  <hr>
  
  <h3>Browser result when manually typed in the address bar</h3>
  
  <p>I am using <code>Firefox 60.5.1esr (64-bit)</code> and <code>Chromium 71.0.3578.98 (Official Build) (64-bit)</code>.</p>
  
  <p><strong>E.g:</strong> When type ‍<code>?identifier=۱</code> at the end of the <code>http://localhost/api</code> :</p>
  
  <p>It redirects to <code>http://localhost/api?identifier=%DB%B1</code> automatically by the browser.</p>
  
  <p>Output of <code>getenv("QUERY_STRING")</code> :</p>
  
  <pre><code>identifier=%DB%B1 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/dpHet.png" alt="Address bar">
  <img src="https://i.stack.imgur.com/yKrya.png" alt="Browser Output"></p>
  
  <h3>Trying with different values:</h3>
  
  <pre><code>۱   =&gt; %DB%B1
  ۲   =&gt; %DB%B2
  ۳   =&gt; %DB%B3
  ۱۲۳ =&gt; %DB%B1%DB%B2%DB%B3
  </code></pre>
  
  <hr>
  
  <p>I also want to support when the user manually modifies the URL (link).
  Guide me.</p>