views:

315

answers:

1

Hi,

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 translate:

        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&#295;&#289;bok &#380;omm din il-bieb mag&#295;luq"

to

"jogħġbok żomm din il-bieb magħluq"
+2  A: 

Hi,

you can convert the html text with System.Web.HttpUtility.HtmlDecode:

        string str = "jog&#295;&#289;bok &#380;omm din il-bieb mag&#295;luq";
        str = System.Web.HttpUtility.HtmlDecode(str); 
        textBox1.Text = str;
        richTextBox1.Text = str;
DA
thanks!!For other that might have this problem, remember to add a reference to Systems.web
mouthpiec