简体   繁体   English

如何使用C#解码此html字符串?

[英]How to decode this html string using C#?

I have some string with javascript format string following : 我有一些带有javascript格式字符串的字符串,如下所示:

\u003Cdiv>\u003Cdiv class=\"mbm detail_research\">\u003Cdiv class=\"clearfix\">\u003Ca class=\"_8o _8r lfloat\" href=\"http:\/\/www.abcm.com\/mutily\/post.php?id=2344324342\" 

Anyone know about how to decode it to normal html string using C#? 有人知道如何使用C#将其解码为普通的html字符串吗?

My mean that it will become to : 我的意思是,它将变成:

<div><div class="mbm detail_research"><div class="clearfix"><a class="_8o _8r lfloat" href="http://www.abcm.com/mutily/post.php?id=2344324342"

after decoded. 解码后。

Thanks for your help! 谢谢你的帮助!

use HttpUtility Class to decode it as : 使用HttpUtility类将其解码为:

String myDecodedString = HttpUtility.HtmlDecode("Html encoded String here");

Follow this MSDN article 遵循这篇MSDN文章

您正在寻找的是Regex.Unescape

var decodedString = Regex.Unescape(yourString);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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