简体   繁体   中英

How to convert HTML char to UNICODE char

I need to convert HTML char eq. &#8220; to UNICODE char. I've tried to use function HtmlUtilities.ConvertToText(string) but unfortunately this function removes whatever exists between < and > . I need a sort of function that works as good as WebView Control , ie HTML markups should be parsed or even removed while the others could be shown in a textblock. It should be used as converter for the textblock.

For example: nicks should be shown from the website bash.org

You're probably looking for WebUtility.HtmlDecode() . That should decode the values from the HTML entity ( &#8220; ) to a character.

Note that it's WebUtility since I think you're trying to accomplish this on a desktop application. If not, use HttpUtility instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM