Azure app service with custom Windows container default encoding is incorrect

drinkwater 0 Reputation points
2024-11-02T15:33:03.27+00:00

I have a web app in azure app service using a custom Windows container.

The base image for the docker image is :

mcr.microsoft.com/dotnet/framework/aspnet:4.7.2

The default encoding in the running container is not what I want.

When doing this powershell command in the running container:

 [System.Text.Encoding]::Default 

The output is :

BodyName : utf-8 EncodingName : Unicode (UTF-8) HeaderName : utf-8 WebName : utf-8 WindowsCodePage : 1200 IsBrowserDisplay : True IsBrowserSave : True IsMailNewsDisplay : True IsMailNewsSave : True IsSingleByte : False EncoderFallback : System.Text.EncoderReplacementFallback DecoderFallback : System.Text.DecoderReplacementFallback IsReadOnly : True CodePage : 65001

But I need :

IsSingleByte : True BodyName : iso-8859-1 EncodingName : Western European (Windows) HeaderName : Windows-1252 WebName : Windows-1252 WindowsCodePage : 1252 IsBrowserDisplay : True IsBrowserSave : True IsMailNewsDisplay : True IsMailNewsSave : True EncoderFallback : System.Text.InternalEncoderBestFitFallback DecoderFallback : System.Text.InternalDecoderBestFitFallback IsReadOnly : True CodePage : 1252

How can I change default encoding (the app in the container is a legacy ASP.NET webforms app and needs to run with iso-8859-1) ?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,884 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.