I would like to include a textbox / richtextbox in which I would like to include text such as
"jogħġbok żomm din il-bieb magħluq".
When I putting this text in the textbox/rightext box I am getting the following:
jogħġbok żomm din il-bieb magħluq
Can you please help?
I am getting the string from google transla开发者_JS百科te:
string url = String.Format("http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}",
input, languagePair);
WebClient webClient = new WebClient();
webClient.Encoding = System.Text.Encoding.UTF8;
string result = webClient.DownloadString(url);
result = result.Substring(result.IndexOf("<span title=\"") + "<span title=\"".Length);
result = result.Substring(result.IndexOf(">") + 1);
result = result.Substring(0, result.IndexOf("</span>"));
return result.Trim();
Edit:
I would like to convert:
"jogħġbok żomm din il-bieb magħluq"
to
"jogħġbok żomm din il-bieb magħluq"
you can convert the html text with System.Web.HttpUtility.HtmlDecode:
string str = "jogħġbok żomm din il-bieb magħluq";
str = System.Web.HttpUtility.HtmlDecode(str);
textBox1.Text = str;
richTextBox1.Text = str;
精彩评论