❔ 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
Isn't
'
an html escape character? Are you downloading a wep page? If so, that's probably the text is in the actual htmlNot 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
Yep - fixed it with HtmlDecode. Thanks, dude
Also: don't use
WebClient
, it's deprecated, use HttpClient
insteadWas 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.