无法在C#中解码UTF-8变音符号

时间:2017-04-17 14:02:19

标签: c# html utf-8 decode webrequest

我有一个问题:

我请求一个包含如下数组的HTML文档:

"entries":[{"element1":"Gem\u00fcse","element2":"zw\u00f6lf","element3":"n\u00e4chster"}]

使用以下代码:

        WebRequest wRequest = WebRequest.Create(URL);
        wRequest.Method = WebRequestMethods.Http.Get;

        using (WebResponse wResponse = wRequest.GetResponse() as WebResponse)
        {
            using (Stream strm = wResponse.GetResponseStream())
            {
                using (StreamReader strmReader = new StreamReader(strm))
                {
                    string htmlDoc = strmReader.ReadToEnd();
                }
            }
        }

现在我想要的是,所有 umlaute 都显示为 ä,ö,ü ,以便字符串 htmlDoc 看起来像这样:

"entries":[{"element1":"Gemüse","element2":"zwölf","element3":"nächster"}]

我该怎么做?

0 个答案:

没有答案