*.cshtml 中的 UTF-8
UTF-8 in *.cshtml
我编辑文字,我的英语非常非常...糟糕
嗨!!!
我在 Visual Studio 2017 年遇到 UTF-8 问题。
我使用 Asp.Net Core 1.1,我的 CSHTML 文件中需要 UTF-8。
我发现改变编纂的一些方法正在进行中
File->Save As..->In save button, click on the Save with Codification 并更改为 Unicode (UTF-8)。
但我每次都需要在每个 cshtml 文件中执行此操作。
我可以将 CSHTML 的默认编码设置为 Unicode(UTF-8)??
谢谢!!
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title> - Teste_db</title>
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="/css/site.css" />
<body>
...
<h2>View�� </h2>
...
</body>
cshtml 文件的默认编码应该是 UTF-8。如果不是,则其他一些工具会弄乱您的文件。
VS 插件 fix-file-encoding 让你 select 根据文件类型应该使用哪种编码。
作为旁注,将 <meta charset="utf-8"/>
添加到 HTML5 文件的 <head>
中,以便正确呈现它们。
我解决了我的问题!!!
我找到了来自 MVC 的默认 .cshtml 文件。
文件在 C:\Users\USER_NAME.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.1.0\Templates\ViewGenerator\
我用 notepad++ 编辑了它们,将格式更改为 UTF-8,现在我可以输入特殊字符,如 çéá...
感谢!!!
我编辑文字,我的英语非常非常...糟糕
嗨!!!
我在 Visual Studio 2017 年遇到 UTF-8 问题。
我使用 Asp.Net Core 1.1,我的 CSHTML 文件中需要 UTF-8。
我发现改变编纂的一些方法正在进行中 File->Save As..->In save button, click on the Save with Codification 并更改为 Unicode (UTF-8)。
但我每次都需要在每个 cshtml 文件中执行此操作。
我可以将 CSHTML 的默认编码设置为 Unicode(UTF-8)??
谢谢!!
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title> - Teste_db</title>
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="/css/site.css" />
<body>
...
<h2>View�� </h2>
...
</body>
cshtml 文件的默认编码应该是 UTF-8。如果不是,则其他一些工具会弄乱您的文件。
VS 插件 fix-file-encoding 让你 select 根据文件类型应该使用哪种编码。
作为旁注,将 <meta charset="utf-8"/>
添加到 HTML5 文件的 <head>
中,以便正确呈现它们。
我解决了我的问题!!!
我找到了来自 MVC 的默认 .cshtml 文件。
文件在 C:\Users\USER_NAME.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.1.0\Templates\ViewGenerator\
我用 notepad++ 编辑了它们,将格式更改为 UTF-8,现在我可以输入特殊字符,如 çéá...
感谢!!!