title: Google TTS API for Arabic, Chinese and Greek
body: <p>I am trying to download an mp3 file from google TTS API, here is the code </p>
  
  <pre><code>try {   
  
          String path ="http://translate.google.com/translate_tts?tl=en&amp;q=hello";
          //this is the name of the local file you will create
          String targetFileName = "test.mp3";
              boolean eof = false;
          URL u = new URL(path);
          HttpURLConnection c = (HttpURLConnection) u.openConnection();
          c.addRequestProperty("User-Agent", "Mozilla/5.0");
          c.setRequestMethod("GET");
          c.setDoOutput(true);
          c.connect();
          FileOutputStream f = new FileOutputStream(new File(Environment.getExternalStorageDirectory()
                  + "/download/"+targetFileName));
              InputStream in = c.getInputStream();
              byte[] buffer = new byte[1024];
              int len1 = 0;
              while ( (len1 = in.read(buffer)) &gt; 0 ) {
              f.write(buffer,0, len1);
                       }
          f.close();
          } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          } catch (ProtocolException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
  
  
      }
  </code></pre>
  
  <p>This works fine, but when I try to make the request for languages like chinese or greek which use special characters</p>
  
  <pre><code>String path ="http://translate.google.com/translate_tts?tl=zh-TW&amp;q=你好";
  </code></pre>
  
  <p>The mp3 file I get back has no sound but from the size of the file I can tell it has data in it. When I try the same with Arabic</p>
  
  <pre><code>String path ="http://translate.google.com/translate_tts?tl=ar&amp;q=%D8%A7%D9%84%D9%84%D9%87";
  </code></pre>
  
  <p>I get back an empty mp3 file with 0 bytes.</p>
  
  <p>I have tried using different user agents and nothing seems to work. </p>
  
  <p>Please help.</p>
  
  <p>Thank You</p>