Razor 视图中文乱码,需注意3点内容
- Web.config 中设置 UTF-8
1
2
3
4
5
6
7
8
9
10<configuration>
...
<system.web>
<compilation debug="true" targetFramework="4.8"/>
<httpRuntime targetFramework="4.8"/>
<!--中文乱码-->
<globalization fileEncoding="utf-8"/>
</system.web>
...
</configuration> - HTML网页 meta 标签
- 文件编码