none
HttpWebResponse.GetResponse() returning the junk Characters. RRS feed

  • Question

  • HttpWebResponse response = await Task.Run(() => (HttpWebResponse)request.GetResponse());

                    if (response.StatusCode == HttpStatusCode.OK)
                    {                    
                        using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                        {
                            responseString = reader.ReadToEnd();
                        }

                    }

    Please find the above code 
    responseString contains a junk characters "�V���[�v �J��"

    Is it because of Encoding type?

    response.Characterset is "ISO-8859-1"

    Friday, March 15, 2019 1:57 PM

All replies

  • Hi DeepakHirapur,

    Thank you for posting here.

    For your question, do you know what is the language of the junk characters? Different language has different format of characters.

    Please try different format of Encoding.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 18, 2019 6:46 AM
    Moderator
  • Thank you Wendy Zang!
    Wednesday, April 10, 2019 6:09 AM
  • Hi DeepakHirapur,

    If your question has been solved, please mark the useful reply as answer. This will make answer searching easier in the forum and be beneficial to community members.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 10, 2019 6:19 AM
    Moderator