1

C# クライアントでデータを使用するために HTML サイトを解析しています。残念ながら、私の HTTPresponse はすべての特殊文字 (フランス語の名前など) をめちゃくちゃにして、疑問符 "?" に置き換えています。問題を解決するために何ができますか?

これが私のコードです:

private void LoadData()
{
    String strBaseURL = @"http://here_goes_the_url.com/";
    StringBuilder sb = new StringBuilder();
    byte[] buf = new byte[8192];
    HttpWebRequest request = (HttpWebRequest)
    WebRequest.Create(strBaseURL);
    HttpWebResponse response = (HttpWebResponse)
    request.GetResponse();
    Stream resStream = response.GetResponseStream();

    string tempString = null;
    int count = 0;

    do
    {
        count = resStream.Read(buf, 0, buf.Length);
        if (count != 0)
        {
            tempString = Encoding.ASCII.GetString(buf, 0, count);
            sb.Append(tempString);
        }
    }
    while (count > 0);
    result = sb.ToString();
}

エンコーディングを変更しようとしましたが、何も起こりません:(

ありがとう!

4

1 に答える 1