Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ASP.NET中解码HTML中的unicode字符_Asp.net_Html - Fatal编程技术网

在ASP.NET中解码HTML中的unicode字符

在ASP.NET中解码HTML中的unicode字符,asp.net,html,Asp.net,Html,我有一个表示HTML块的字符串。所有unicode字符都已编码。因此,在插入数据库时需要占用大量空间。 例如:thích保存为thí;ch 如何解码这些unicode字符?我不能使用HttpUtility.HtmlDecode,因为它会解码一些其他字符,如>或

我有一个表示HTML块的字符串。所有unicode字符都已编码。因此,在插入数据库时需要占用大量空间。 例如:
thích

保存为
thí;ch


如何解码这些unicode字符?我不能使用HttpUtility.HtmlDecode,因为它会解码一些其他字符,如>或<,我仍然希望对其进行编码。

手动重新编码非unicode特定字符怎么样

Server.HtmlDecode(str).Replace("<","&lt;")
                      .Replace(">","&gt;")
                      .Replace("&","&amp;")
                      .Replace("\"","&quot;")
                      .Replace("\'","&#39;")
Server.HtmlDecode(str).Replace(“,”)
.替换(“&”、“&;”)
.替换(“\”,“”)
.替换(“\”、“';”)

您能告诉我“其他内容”中包含了什么吗?我的意思是,为了正确显示,必须对哪些内容进行编码?以下内容是否足够→ &;<→ > → " → "我想加上
→ ';
就这样。我已经更新了我的答案。没关系。只需要在做任何其他事情之前移动替换(&E)。