I am developing a text-to-speech iphone app that support multi-languages.
Here is my request URL
requestUrlStr = @"http://www.translate.google.com/translate_tts?tl=en&q=hello";
for english the above url has no problem
but for Chinese
requestUrlStr = @"http://www.translate.google.com/translate_tts?tl=zh-TW&q=你好";
I know the above url will give 'Bad URL', so I used follow method to encode the string into UTF-8
requestUrlStr = [requestUrlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
It will become
http://www.translate.google.com/translate_tts?tl=zh-CN&q=%E4%BD%A0%E5%A5%BD
Then the Google TTS cannot recognize this Chinese text.
You have to pretend to be a User-Agent other than the default (appName, etc) in your NSURLRequest. Try this (I use Greek language) ...
UPDATE 2017
Since our favorite companies enjoy to update and deprecate things, here is the above example as it should be now...
The
...delegate:nil delegateQueue:[NSOperationQueue mainQueue]
can be omitted.