2013-05-22 95 views
-1

如何将HTML特殊字符编码为其实际值?如何将HTML特殊字符解码为其实际值?

数据:

Antique bronze of an archer by Franz Iffland Literature:
“Bronzes, sculptors and founders” by H. Berman, Abage. 
“Dictionnaire illustré des sculpteurs animaliers & fondeurs de l’antiquité à nos jours “ by Jean Charles Hachet. Argus Valentines. 
“The dictionary of sculptors in bronze” by James Mackay. Antique collectors club. 
 Fedex shipping: $ 185 


需要的输出:

Antique bronze of an archer by Franz Iffland Literature:
“Bronzes, sculptors and founders” by H. Berman, Abage. 
“Dictionnaire illustré des sculpteurs animaliers & fondeurs de l’antiquité à nos jours “ by Jean Charles Hachet. Argus Valentines. 
“The dictionary of sculptors in bronze” by James Mackay. Antique collectors club. 
 Fedex shipping: $ 185 
+0

我想你可以删除你自己尼廷http://meta.stackexchange.com/questions/问题42265 /我怎么能删除我的问题 –

+0

回滚奇怪的编辑... – Joetjah

+0

删除这个问题,因为它是重复的 –

回答

1

您可以使用

string output = WebUtility.HtmlDecode(Data); 

它配备下命名空间。

1

使用HttpUtility.HtmlDecodeWebUtility.HtmlDecode

string s = "Antique bronze of an archer by Franz Iffland Literature:
“Bronzes, sculptors and founders” by H. Berman, Abage. 
“Dictionnaire illustré des sculpteurs animaliers & fondeurs de l’antiquité à nos jours “ by Jean Charles Hachet. Argus Valentines. 
“The dictionary of sculptors in bronze” by James Mackay. Antique collectors club. 
 Fedex shipping: $ 185"; 
var s2 = HttpUtility.HtmlDecode(s); 
var s3 = WebUtility.HtmlDecode(s); 
3

使用HtmlDecode

string source ="Antique bronze of an archer by Franz Iffland Literature:
“Bronzes, sculptors and founders” by H. Berman, Abage. 
“Dictionnaire illustré des sculpteurs animaliers & fondeurs de l’antiquité à nos jours “ by Jean Charles Hachet. Argus Valentines. 
“The dictionary of sculptors in bronze” by James Mackay. Antique collectors club. 
 Fedex shipping: $ 185"; 

string decoded= WebUtility.HtmlDecode(source); 
1
string res = Server.HtmlDecode("ntique bronze of an archer by Franz Iffland Literature:
“Bronzes, sculptors and founders” by H. Berman, Abage. 
“Dictionnaire illustré des sculpteurs animaliers & fondeurs de l’antiquité à nos jours “ by Jean Charles Hachet. Argus Valentines. 
“The dictionary of sculptors in bronze” by James Mackay. Antique collectors club. 
 Fedex shipping: $ 185");