Decode does not work

Asked

Viewed 45 times

-1

I’m using the htmlagilitypack, where a url extraction is done inside a div, the problem is that it is not correctly bringing the encoding.

Request from. net:

string requisita = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252)).ReadToEnd();

I get a link like this: https://pt.wikipedia.org/wiki/combina%25C3%25A7%25C3%25A3o

I needed you to return: https://en.wikipedia.org/wiki/Combination

I tried to System.Web.HttpUtility.UrlDecode(link) and System.Uri.UnescapeDataString(link) but returns same thing.

  • instead of negative, just put a comment. the person thinks that we put here for fun?! that bad taste

1 answer

0

It is returning like this due to the 1252 encoding you are using:

1252 Windows-1252 Western European (Windows)

Use the UTF-8:

string requisita = new StreamReader(response.GetResponseStream(), 
                    Encoding.GetEncoding(65001)).ReadToEnd();

Check this link from microsoft the table of encondings.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.