I'm using this link: https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=myTextHere
When I feed it Japanese characters such as, テスト中..., the DownloadString method returns strange characters such as this: ム† ã,¹ãƒä¸ ...
The correct string should be "Under Test..."
You can see for yourself by clicking the link on your browser: https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=テスト中
I've tried multiple things such as setting the client's encoding to UTF-8 and using HttpUtility.UrlEncode(myText)
but I could not get what my browser returns. Swapping DownloadString for DownloadFile as txt returns the same incorrect text. How do I get the same results as the browser?
Here's a small code snippet that resembles my environment:
String s = "テスト中";
Console.WriteLine("src="+s);
WebClient client = new WebClient();
client.Encoding = Encoding.UTF8;
string downloadString = @client.DownloadString("https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=" + HttpUtility.UrlEncode(s));
Console.WriteLine("data:{\n"+downloadString+"\n}");