Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
When migrating from OWIN/Katana + HTTP.sys to ASP.NET Core + HTTP.sys, response headers containing non-ASCII characters are encoded differently.
OWIN/Katana + HTTP.sys: Response header values are encoded as Latin-1 (ISO-8859-1). A character like U+00A0 (non-breaking space) becomes a single byte 0xA0 on the wire.
ASP.NET Core + HTTP.sys: Response header values are encoded as UTF-8. The same U+00A0 becomes two bytes 0xC2 0xA0 on the wire, which clients interpret as two separate characters (Â + NBSP).
Kestrel provides ResponseHeaderEncodingSelector on KestrelServerOptions to control this. HTTP.sys only has UseLatin1RequestHeaders for request headers (added in .NET 5) — there is no equivalent for response headers.
Describe the solution you'd like
Add a UseLatin1ResponseHeaders property (or a more general ResponseHeaderEncoding option) to HttpSysOptions, similar to:
HttpSysOptions.UseLatin1RequestHeaders (existing, request-side only)
KestrelServerOptions.ResponseHeaderEncodingSelector (Kestrel equivalent)
This would allow applications migrating from OWIN/Katana to ASP.NET Core HTTP.sys to maintain wire-level compatibility for response headers.
Additional context
Current state in .NET 8/9:
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
When migrating from OWIN/Katana + HTTP.sys to ASP.NET Core + HTTP.sys, response headers containing non-ASCII characters are encoded differently.
OWIN/Katana + HTTP.sys: Response header values are encoded as Latin-1 (ISO-8859-1). A character like U+00A0 (non-breaking space) becomes a single byte
0xA0on the wire.ASP.NET Core + HTTP.sys: Response header values are encoded as UTF-8. The same U+00A0 becomes two bytes
0xC2 0xA0on the wire, which clients interpret as two separate characters (Â+ NBSP).Kestrel provides
ResponseHeaderEncodingSelectoronKestrelServerOptionsto control this. HTTP.sys only hasUseLatin1RequestHeadersfor request headers (added in .NET 5) — there is no equivalent for response headers.Describe the solution you'd like
Add a
UseLatin1ResponseHeadersproperty (or a more generalResponseHeaderEncodingoption) toHttpSysOptions, similar to:HttpSysOptions.UseLatin1RequestHeaders(existing, request-side only)KestrelServerOptions.ResponseHeaderEncodingSelector(Kestrel equivalent)This would allow applications migrating from OWIN/Katana to ASP.NET Core HTTP.sys to maintain wire-level compatibility for response headers.
Additional context
Current state in .NET 8/9:
UseLatin1RequestHeaders