Google Translate from English to Chinese and vice versa is not working
<pre><code>using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Threading;

public partial class GoogleTrans : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Response.Write(GetTranslatedText("Welcome", LangPair.EnglishToChineseSimplified)); // english to chinese
            Response.Write("&lt;br /&gt;");
            Response.Write(GetTranslatedText("欢迎", LangPair.ChineseSimplifiedToEnglish)); // chinese to english
        }
    }

    public enum LangPair
    {
        EnglishToGerman,
        EnglishToSpanish,
        EnglishToFrench,
    EnglishToItalian,
    EnglishToPortuguese,
    EnglishToJapanese,
    EnglishToKorean,
    EnglishToChineseSimplified,
    GermanToEnglish,
    GermanToFrench,
    SpanishToEnglish,
    FrenchToEnglish,
    FrenchToGerman,
    ItalianToEnglish,
    PortugueseToEnglish,
    JapaneseToEnglish,
    KoreanToEnglish,
    ChineseSimplifiedToEnglish
}

public ArrayList GetLangPairs()
{
    ArrayList al = new ArrayList();
    Array vals = Enum.GetValues(typeof(LangPair));
    al.Add("Please Select");
    foreach (object o in vals)
        al.Add(o.ToString());
    return al;
}


public string GetTranslatedText(string textToTranslate, LangPair langPair)
{
    string strLangPair = String.Empty;
    switch (langPair)
    {
        case (LangPair.ChineseSimplifiedToEnglish): strLangPair = "zh-CN%7Cen"; break;
        case (LangPair.EnglishToChineseSimplified): strLangPair = "en%7Czh-CN"; break;
        case (LangPair.EnglishToFrench): strLangPair = "en%7Cfr"; break;
        case (LangPair.EnglishToGerman): strLangPair = "en%7Cde"; break;
        case (LangPair.EnglishToItalian): strLangPair = "en%7Cit"; break;
        case (LangPair.EnglishToJapanese): strLangPair = "en%7Cja"; break;
        case (LangPair.EnglishToKorean): strLangPair = "en%7Cko"; break;
        case (LangPair.EnglishToPortuguese): strLangPair = "en%7Cpt"; break;
        case (LangPair.EnglishToSpanish): strLangPair = "en%7Ces"; break;
        case (LangPair.FrenchToEnglish): strLangPair = "fr%7Cen"; break;
        case (LangPair.FrenchToGerman): strLangPair = "fr%7Cde"; break;
        case (LangPair.GermanToEnglish): strLangPair = "de%7Cen"; break;
        case (LangPair.GermanToFrench): strLangPair = "de%7Cfr"; break;
        case (LangPair.ItalianToEnglish): strLangPair = "it%7Cen"; break;
        case (LangPair.JapaneseToEnglish): strLangPair = "ja%7Cen"; break;
        case (LangPair.KoreanToEnglish): strLangPair = "ko%7Cen"; break;
        case (LangPair.PortugueseToEnglish): strLangPair = "pt%7Cen"; break;
        case (LangPair.SpanishToEnglish): strLangPair = "es%7Cen"; break;
        default: strLangPair = "en%7Cde"; break;
    }

    string url = "http://translate.google.com/translate_t?text="
            + textToTranslate + "&amp;langpair=" + strLangPair;

    string result = string.Empty;
    using (WebClient webClient = new WebClient())
    {

        webClient.Proxy = WebRequest.DefaultWebProxy;
        webClient.Credentials = new NetworkCredential("username", "password", "domain.COM");
        webClient.Proxy.Credentials = new NetworkCredential("username", "password", "domain.COM");

        result = webClient.DownloadString(url);
    }

    string[] stuff = GetTagsByName(result, "textarea");
    Regex findData = new Regex(@"&lt;(?&lt;tag&gt;.*).*&gt;(?&lt;text&gt;.*)&lt;/\k&lt;tag&gt;&gt;");
    Match foundData = findData.Match(stuff[0]);
    return foundData.Groups["text"].Value;
}


private string[] GetTagsByName( string Source, string TagName)
{
    RegexOptions opts = RegexOptions.IgnoreCase | RegexOptions.Singleline;
    string strPattern;
    if (TagName != "!")
    {
        Source = StripComments(Source);
        strPattern = "&lt;(?&lt;TagName&gt;" + TagName + @")(&gt;|\s+[^&gt;]*&gt;)";
    }
    else
        strPattern = "&lt;(?&lt;TagName&gt;" + TagName + @")-";

    MatchCollection mc = Regex.Matches(Source, strPattern, opts);
    ArrayList strTagContents = new ArrayList();

    foreach (Match m in mc)
    {
        strTagContents.Add(
            GetTagByName(TagName,  Source.Substring(m.Groups["TagName"].Index - 1))
            );
    }

    return ((string[]) strTagContents.ToArray(typeof(String)));
}

string StripComments(string Source)
{
    Regex r = new Regex(GetExpressionForTagContents("!"));

    return (r.Replace(Source,""));
}

private string GetTagByName(string strTagName, string strSource)
{
    string strPatternTag =
        GetExpressionForTagContents(
            strTagName);
    string strPatternTagNoClose
        = "&lt;" + strTagName +
            @"(&gt;|\s+[^&gt;]*&gt;)[^&lt;]";

    RegexOptions opts = RegexOptions.IgnoreCase | RegexOptions.Singleline;
    Match m;
    string strGetTagByName;

    m = System.Text.RegularExpressions.
        Regex.Match(strSource, strPatternTag, opts);

    if (m.Value == "")
    {
        m = System.Text.RegularExpressions.
                Regex.Match(strSource,
                strPatternTagNoClose, opts);
        if (m == null)
            strGetTagByName = strSource;
        else
            strGetTagByName = m.Value;
    }
    else
        strGetTagByName = m.Value;
    return (strGetTagByName);
}

private string GetExpressionForTagContents(string strTagName)
{
    string strPatternTag;
    if (strTagName == "!")
        strPatternTag = "&lt;!.*?-&gt;";
    else
        if (string.Compare(strTagName,
            "!doctype", true) == 0)
            strPatternTag =
                "&lt;!doctype.*?&gt;";
        else
            if (String.Compare(
            strTagName, "br", true) == 0)
                strPatternTag =
                    @"&lt;br\s*/?\s*&gt;";
            else
                strPatternTag
                    = @"&lt;(" + strTagName +
                @")(&gt;|\s+[^&gt;]*&gt;).*?&lt;/\1\s*&gt;";
    return (strPatternTag);
}
</code></pre>

<p>}</p>

<p>The output I am getting is </p>

<p>Welcome</p>

<p>»¶Ó­</p>

<p>When I copy and past the url I am getting the correct result.</p>

<p><a href="http://translate.google.com/translate_t?text=%E6%AC%A2%E8%BF%8E&amp;langpair=zh-CN%7Cen" rel="nofollow">http://translate.google.com/translate_t?text=%E6%AC%A2%E8%BF%8E&amp;langpair=zh-CN%7Cen</a></p>

<p><a href="http://translate.google.com/translate_t?text=Welcome&amp;langpair=en%7Czh-CN" rel="nofollow">http://translate.google.com/translate_t?text=Welcome&amp;langpair=en%7Czh-CN</a></p>

<p>what am I doing wrong?</p>
