title: C++ URL decode with utf8 characters error
body: <p>I can`t find any solution to my problem with utf8 characters inside an encoded url while in c++ visual studio.</p>
  
  <p>I have this url encoded string :</p>
  
  <pre><code>//Encoded
  %5C%CE%A4%CE%B5%CF%83%CF%84%5C
  //Decoded
  \Τεστ\
  </code></pre>
  
  <p>In any online encoder and decoder with php functions the above encoded string will give you the decoded correct string but in c++ visual studio any try i made with decoding url codes failed.</p>
  
  <p>I use Unicode Character Set in my project and i retrieve this encoded url as : (p.s. i cant change the way i recieve it - it is an encoded url std:string)</p>
  
  <pre><code>std:string EncURL = "%5C%CE%A4%CE%B5%CF%83%CF%84%5C";
  </code></pre>
  
  <p>i then try with many decoding function from the internet to make it readable and use it but it always returns me chinese characters instead of the correct ones.
  Below is a function among many that i tried and it works only if the encoded url has no utf8 characters inside.</p>
  
  <pre><code>string url_decode(string src){
    string ret;
    char ch;
    int i,ii;
    for(i=0; i&lt;src.length(); i++){
       if(int(src[i]) == 37){
         sscanf(src.substr(i+1,2).c_str(), "%x", &amp;ii);
         ch = static_cast&lt;char&gt;(ii);
         ret += ch;
         i = i+2;
       }else{
          ret += src[i];
       }
    }
    return (ret);
  }
  </code></pre>
  
  <p>Will anyone give me a good way or solution of making URLdecoding function that will work properly even with utf8 characters inside ?
  Any type or any way is used after the std:string EncURL doesnt matter, i just need to have a properly urldecoder in c++ for the string i recieve.</p>
  
  <p>---------- Update</p>
  
  <p>The reason that i need to convert is obvious for URL opening or filepath opening (folder or file) from within c++ but the encoded URL string is coming as is encoded inside C++ from outside the application.(database, web, chat, file, etc etc) 
  So i need to decode it in utf8 since i need to correct that non latin part for multilanguage purposes and then to use the decoded utf8 string for the reason is needed.</p>
  
  <p>This update may helps for non converting it just for wcout or cout but for its target puprose which i really need and nothing yet is working as it should.</p>
  
  <p>Thank you in advance</p>