razor view » character rendered as »

前端 未结 1 891
孤城傲影
孤城傲影 2021-01-18 07:11

The » character seems to get rendered as » in a razor view. I have tried




        
相关标签:
1条回答
  • 2021-01-18 07:41

    I suspect that your .cshtml view/partial containing this character is not saved with the UTF-8 with signature encoding. Also do the same verification for the _Layout. In VS use the Save As with encoding dialog:

    enter image description here

    Also make sure that you have put the » character as-is in your view. Not coming from a string, XML or a database. If it comes from somewhere else make sure that it is not corrupted already when you are reading it. If this is the case please show the code that is retrieving the string that you are trying to output in the view.

    Final remark about your meta tag: if you are using HTML5 use:

    <meta charset="utf-8" />
    
    0 讨论(0)
提交回复
热议问题