Skip to content
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

System.Web.HttpResponse: fix default encoding #21415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deltragon
Copy link

@deltragon deltragon commented Jan 30, 2022

Split out of #21247, as it is a separate simple change and also fixes a bug.

By default, .NET does not append the charset to the Content-Type header if the response is empty. This was corrected in mono in #866.
However, as soon as any content is written to the response, it should append the charset. When just using HttpResponse.Write(), this defaults to utf-8.
(Note: I reverse-engineered this behavior from the referencesource.)

This PR fixes this behavior, and adds an additional testcase for the non-empty response.
This testcase has not been run on windows/.NET, as I do not have mono set up there. Does someone else need to check if this test passes on .NET or is this checked as part of CI?

Fixes https://bugzilla.xamarin.com/23/23810/bug.html

@deltragon
Copy link
Author

I am not sure if the CI failures are my fault? If they are, I don't understand the output properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant