HtmlEncode with HTML entity name, is it possible?

后端 未结 1 727
暗喜
暗喜 2020-12-20 04:19

I am using the following method to HtmlEncode some text that it\'s in Spanish, like this:

string word = \"configuració         


        
相关标签:
1条回答
  • 2020-12-20 05:04

    HtmlEncode(word); does only encode ISO 8859-1 (Latin-1). Which means your input needs to be encoded in ISO 8859-1. The ó is not in the iso standard, you can try to use the AntiXss encoder:

    Microsoft.Security.Application.AntiXss.HtmlEncode("ó"); 
    
    or Microsoft.Security.Application.Encoder.HtmlEncode("ó");
    
    0 讨论(0)
提交回复
热议问题