C
C#13mo ago
stigzler

❔ How to stop WebClient.DownloadString encoding apostrophies?

Does anyone know why WebClient.DownloadString encodes certain characters (e.g. apostrophe) even when .Encoding set to UTF8? E.g. "If you don't shoot fast enough" comes back as: "If you don't shoot fast enough"
6 Replies
nathanAjacobs
nathanAjacobs13mo ago
Isn't ' an html escape character? Are you downloading a wep page? If so, that's probably the text is in the actual html
stigzler
stigzlerOP13mo ago
Not sure - downloading from an API - guess it must be html encoding as I'm getting the above text directly via the VS debugger from the direct result of the DonwloadString Method
stigzler
stigzlerOP13mo ago
Yep - fixed it with HtmlDecode. Thanks, dude
Angius
Angius13mo ago
Also: don't use WebClient, it's deprecated, use HttpClient instead
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server