title: How to encode arbitrary string for request in Node.js?
body: <p>I have  a string like that:  "abcde 李".  It can be any string with non latin characters.</p>
  
  <p>I want to encode it to use in request, so it will be "abcde %E6%9D%8E" and can be used for http.request.</p>
  
  <p>I have tried this:</p>
  
  <pre><code>str.toString("utf-8");
  </code></pre>
  
  <p>or </p>
  
  <pre><code>var buffer = new Buffer(str);
  str = buffer.toString('utf-8');
  </code></pre>
  
  <p>but none of them work.  what is the proper way to handle this? </p>