Open GoogleCodeExporter opened 8 years ago
[deleted comment]
Here is what I discovered more:
If you try to do text to speech in Chinese and you call getAudio method by
passing normal Latin characters, the audio will be played correctly in IDE AND
outside the IDE.
If you call getAudio with Chinese characters, no audio will be returned when
running from outside the IDE only when running from IDE.
So there must be something wrong when calling with these special Chinese,
Japanese, Hindi, Arabic characters ....
Example:
//THIS WORKS WELL BOTH IN IDE AND OUTSIDE THE IDE
Audio audio = Audio.getInstance();
InputStream sound = audio.getAudio("aaaaabbbbcccc", Language.CHINESE);
audio.play(sound);
//THIS WORKS ONLY INSIDE IDE
Audio audio = Audio.getInstance();
InputStream sound = audio.getAudio("但所给內容兩相矛盾",
Language.CHINESE);
audio.play(sound);
Anyway this work is fantastic. Thank you!
Original comment by virtejfl...@gmail.com
on 9 May 2013 at 10:14
Found the solution:
in getAudio method, you must encode the text to be played, to UTF-8, before
appending it to the URL:
String encodedString = URLEncoder.encode(text, "UTF-8");
URL url = new URL(URLCONSTANTS.GOOGLE_TRANSLATE_AUDIO + "q="
+ encodedString + "&tl=" + languageOutput);
Now it works fine!!!
Original comment by virtejfl...@gmail.com
on 9 May 2013 at 10:58
thanks....its working
Original comment by xyza6...@gmail.com
on 19 Mar 2014 at 9:22
Original issue reported on code.google.com by
virtejfl...@gmail.com
on 9 May 2013 at 9:37