C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着
   public string getUrl(string url)
        {
            MatchCollection mats = Regex.Matches(url, "(?<first>[\\w]*)=(?<two>[\u4e00-\u9fa5]*)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
            foreach (Match mat in mats)
            {
                //Response.Write(mat.Groups["first"].Value + "----");
                //Response.Write(mat.Groups["two"].Value + "------2");
                url = url.Replace(mat.Groups["first"].Value + "=" + mat.Groups["two"].Value, mat.Groups["first"].Value + "=" + HttpUtility.UrlEncodeUnicode(mat.Groups["two"].Value.Trim()));
                // Response.Write(url.Replace(mat.Groups["first"].Value + "=" + mat.Groups["two"].Value, mat.Groups["first"].Value + "=" + HttpUtility.UrlEncode(mat.Groups["two"].Value.Trim())));
                //Response.Write(HttpUtility.UrlDecode(HttpUtility.UrlEncode(mat.Groups["two"].Value.Trim())));
            }
            return url;
        }
posted on 2008-06-23 15:58  王德田  阅读(423)  评论(2编辑  收藏  举报