-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor compile-time HTML encoding breaks £ #11225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It might be the case here that the item-template is missing a BOM. If I create a new component using the item template and save, it doesn't have one. |
I looked at this and we have a lot of inconsistencies in our template. I created a new project with Contains BOM:
Does not contain BOM:
On top of this, VS
I also put the pound-sign (£) in many of these files and found that it does not render correctly on files with no BOM. @rynowak @SteveSandersonMS @danroth27, do we want to require Also, I filed an issue to handle the inconsistencies in our templates. |
From your investigation, it sounds like we do need them to contain a BOM. But that's a bit awkward, since it's increasingly common these days not to use BOMs and for no-BOM to signal "UTF-8". Is it possible to handle this in the Razor compiler by making it interpret no-BOM files as UTF-8? |
@mkArtakMSFT, I'm assigning this to myself. |
I think the real problem is that Visual Studio saves files without BOM with ANSI encoding. I have Polish Windows (ANSI 1250) and English Visual Studio. Now lets assume I have a simple text file with only ASCII (English) text. I can open it in VS, add some Polish letters In my projects I always have # http://EditorConfig.org
root = true
[*]
charset = utf-8
# charset = utf-8-bom
indent_style = space
indent_size = 4
tab_width = 4
trim_trailing_whitespace = true
end_of_line = crlf
insert_final_newline = true Probably there are a lot of people who are not aware that VS supports |
After more investigation, turns out Blazor isn't the cause of this issue. Reading UTF-8 files without BOM works just fine. The cause of this issue was that for some reason Visual Studio was saving the |
Do the blazor workshop up to https://github.com/dotnet-presentations/blazor-workshop/blob/master/docs/02-customize-a-pizza.md#add-additional-toppings - should take like 10 min
using 16.2p2 (public preview) and .NET Core 3.0 preview 6
You'll notice that the pound-sign (£) has been replaced in the generated code with a
65533
character - the replacement character. This means that instead of £ we tried to write some invalid unicode sequence and the encoder turned it into the replacement character.Sorry, I don't have a more isolated repro of this and I tried a few things.
The text was updated successfully, but these errors were encountered: