-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Release built docker image with unicode encoder issue #38743
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
Here is a snapshot of my environment (dotnet --info)
|
Are your files stored with UTF8 encoding / UTF8+BOM encoding? We've seen other issues where files are stored using Window's CodePage encoding which results in garbled text on non-Windows OSes. |
Hi @jan-johansson-mr. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hi @pranavkm, This was very interesting! :-) The web app is stored with Window's code page Windows-1252 (CP1252) character set, while the console app is stored with UTF8+BOM encoding. This might actually be the source of the issue I see. It explains why there is no problem with the console app in my investigation, but there is a problem with the web app. It also tells me that the template for web app in VS 2022 comes with CP1252, while other template (e.g. console app) comes with UTF8+BOM. I saved the file (Program.cs) in the web app with Unicode (UTF-8 with signature) - Codepage 65001 (UTF8+BOM) and now the characters are displayed fine in the web app too (Linux container image), as it is in console app. This was tricky! But I'm happy :-) Now I'm thinking that there has to be some VS 2022 settings somewhere that tells VS to save all my files (including new ones) as UTF8+BOM. I hope there is one... |
I've found using an .editorconfig works really well for this:
We're using #37201 to ensure the files .NET Core project or item templates scaffold use a BOM since it makes things a lot more predictable. |
Thanks, closing this issue since it's handled by another thread. |
I've opened an issue that I thought maybe is better suited in this area.
What the issue is
The Swedish letters å, ä, ö, Å, Ä and Ö are not properly encoded in a release built Linux container image, based on aspnetcore runtime.
How to reproduce
Simply create a web app from VS 2022 template, remove all the setup code and so on, and leave one liner
Console.WriteLine("åäöÅÄÖ");
Then release build the Linux container image (e.g. docker) and run it. The letters are printed as
U+FFFD U+FFFD U+FFFD U+FFFD U+FFFD U+FFFD (I've inserted spaces for readability)
What was the expected behavior and how to reproduce that
Create a console app from VS 2022 template, and leave the one liner as
Console.WriteLine("åäöÅÄÖ");
Then release build the Linux container image (e.g. docker) and run it. The letters are printed as
åäöÅÄÖ
How to resolve the issue with the web app
I have no idea. I've tried different approaches as I've described in the original thread, but nothing works.
What is effected
I saw the issue first with my web app, and started the investigation. I have no resolution to the issue.
The text was updated successfully, but these errors were encountered: