title: Translate demo failed to translate Chinese, maybe the encode failure?
body: <p>Recently, I implemented a online translate demo, yes, it worked well when a tried to translate a English word to Chinese, but unfortunately, it's failed to translate a Chinese word to English.</p>
  
  <p>I think maybe this issue was caused by the encode of the Chinese, I tried to print the url, and copy them to IE, the result IE returned is right.</p>
  
  <p>The code is as follows:</p>
  
  <pre><code>/*
  Filename: translate.cc
  Author: BerlinSun
  */
  #include &lt;iostream&gt;
  #include "curl/curl.h"
  #include "json/json.h"
  
  using namespace std;
  
  void usage()
  {
      cout &lt;&lt; "Usage: translate word_you_want_to_translate" &lt;&lt; endl;
  }
  
  int writer(char *data, size_t size, size_t nmemb, string *writerData)
  {
      if (writerData == NULL)
          return 0;
      int len = size*nmemb;
      writerData-&gt;append(data, len); 
      return len;
  }
  
  int main(int argc, char *argv[])
  {
      if(argc &lt; 2)
      {
          usage();
          exit(0);
      }
      string buffer;
      string translate_url = "http://fanyi.youdao.com/openapi.do?keyfrom=xxxxxx&amp;key=xxxxxx&amp;type=data&amp;doctype=json&amp;version=1.1&amp;q=";
      translate_url += argv[1];
      CURL * curl;
      CURLcode res;
      curl = curl_easy_init();
      if (curl)
      {
          curl_easy_setopt(curl, CURLOPT_URL, translate_url.c_str());
          curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
          curl_easy_setopt(curl, CURLOPT_WRITEDATA, &amp;buffer);
          res = curl_easy_perform(curl);
          curl_easy_cleanup(curl);
      }
      if (buffer.empty())
      {
          cout &lt;&lt; "The server return NULL!" &lt;&lt; endl;
          exit(0);
      }
  
      Json::Value root;
      Json::Reader reader;
      bool parsingSuccessful = reader.parse(buffer, root);
  
      if (!parsingSuccessful)
      {
          cout &lt;&lt; "Failed to parse the data!" &lt;&lt; endl;
          exit(0);
      }
  
      const Json::Value basic = root["basic"];
      const Json::Value phonetic = basic["phonetic"];
      const Json::Value explains = basic["explains"];
      cout &lt;&lt; "Provided by Youdao dictionary!" &lt;&lt; endl;
      cout &lt;&lt; "-----------------------------" &lt;&lt; endl;
      cout &lt;&lt; argv[1] &lt;&lt; "\t英[" &lt;&lt; phonetic.asString()  &lt;&lt; "]" &lt;&lt; endl;
  
      for(int i = 0; i &lt; explains.size(); ++i)
          cout &lt;&lt; explains[i].asString() &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>