-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
This is a successor of #11530.
All .cshtml and .razor files have UTF-8 encoding with BOM. All .cs files have no BOM. This in combination with Visual Studio results in files being saved in ANSII (or system code page) encoding.
We've hit this problem when adding an error to the ModelState in the code behind file:
ModelState.AddModelError(string.Empty, "This is an error with än umlaut.");Visual Studio will not save this with UTF-8 encoding and this will break the error message in the browser.
Expected Behavior
To work around the Visual Studio behaviour, all templates files should be in UTF-8 encoding with BOM.
Steps To Reproduce
- add a new razor page (either via context menu in VS or
dotnet new page --name Umlaut --namespace YourApp.Pages --output Pages) - in Visual Studio add an Umlaut (
ModelState.AddModelError(String.Empty, "Än Umlaut");) - build on linux
dotnet build -c release - the binary contains a unicode replacement character
�which will be rendered in the markup
a minimal repro is available at unicorn-development/aspnetcore57679
Exceptions (if any)
No response
.NET Version
8.0
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates