我发现了一个关于如何将ISO-8859-1字符转换为实体编号的问题 C# convert ISO-8859-1 characters to entity number 代码:
string input = "Steel Décor";
StringBuilder output = new StringBuilder();
foreach (char ch in input)
{
if (ch > 0x7F)
output.AppendFormat("&#{0};", (int) ch);
else
output.Append(ch);
}
// output.ToString() == "Steel Décor"
但我没有弄清楚如何从实体编号转换为相反的字符
//"Steel Décor" to "Steel Décor"
ps:我的字符串中的所有重音字符都是实体代码