2010-12-01 46 views
0

我使用谷歌翻譯API將文本從英文翻譯成德文。 我使用的代碼是:從Google的翻譯API獲取響應時錯誤的編碼?

string url = String.Format("http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}", TxtEnglish.Text, Constants.LanguagePair); 

WebClient webClient = new WebClient(); 
webClient.Encoding = System.Text.Encoding.UTF8; 

webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(TextTranslation_DownloadStringCompleted); 
webClient.DownloadStringAsync(new Uri(url)); 

在接收e.Result ....... 原始文本的迴應:你能幫助我嗎?

翻譯翻譯頁面上德語文本:können Sie mir helfen

結果在e.Resultk�nnen Sie mir helfen

所以,plz幫助我知道爲什麼會這樣「」特殊字符快到了,我該如何解決這個問題?

回答

0

使用Fiddler檢查響應標題,您將在其中找到編碼。

它顯示的方式可能與您收到的數據無關,可能與您在UI代碼中表示它的方式有關。分享一下,我們會看看。