剃刀观点»人物呈现为一个» [英] razor view » character rendered as »

查看:105
本文介绍了剃刀观点»人物呈现为一个»的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该»性格似乎剃刀观点得到呈现为»。我曾尝试

 < META HTTP-EQUIV =Content-Type的CONTENT =text / html的;字符集= UTF-8/>

  @ Html.Raw()

但问题不会消失。我没有跟ASPX的意见这个问题。

此外,文化被设置为

 <全球化的UICulture =EN文化=EN-US/>


解决方案

我怀疑你的 .cshtml 查看/含该字符的部分不保存与UTF-8与签名编码。还做了 _layout 相同的验证。在VS使用另存为对话框编码

另外,还要确保你已经把»字符作为,是在你的看法。不是从一个字符串,XML或数据库来了。如果它是来自其他地方确保当你阅读它,它没有被破坏了。如果是这种情况下,请出示code被检索您试图输出在视图中的字符串。

你的meta标签最后一句话:如果你使用的是HTML5的使用:

 <间的charset =UTF-8/>

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

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

and

@Html.Raw()

but the problem does not go away. I did not have this issue with ASPX views.

Also, culture is set as

<globalization uiCulture="en" culture="en-US" />

解决方案

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:

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" />

这篇关于剃刀观点»人物呈现为一个»的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆