title: URI Escape C++ wstring
body: <p>I am looking for a good way to do a URI Escape in C++ that would be reasonable for a cross platform project.</p>
  
  <p>I would like a function that would take a string like this:</p>
  
  <pre><code>L"jiayou加油"
  </code></pre>
  
  <p>And return:</p>
  
  <pre><code>L"jiayou%E5%8A%A0%E6%B2%B9"
  </code></pre>
  
  <p>I looked at using some thing like <a href="http://inamidst.com/code/uriescape.c" rel="nofollow noreferrer">this</a>, with minor modifacations to use wchar_t. However that would require converting from utf-16 to utf-8 before the printf call. This has lead me down character encoding hell.</p>
  
  <p>This and all the other approaches I have looked into just feel like the wrong way. Is there a good way to URI Escape a wstring in C++?</p>