Reputation: 11387
The code that responds to a request is the following:
return new HttpStatusCodeResult(ex.Detail.HttpStatusCode, ex.Detail.ReasonPhrase);
Response.AddHeader("X-Status", ex.Detail.ReasonPhrase);
The funny thing here is that, on the browser/client, when there's a special char involved (such as ç
or é
) the reason phrase renders as expected, but the X-Status does NOT!!!
here's a screenshot for the non-believers
I've tested a uncountable number of encoding combinations but none worked... the X-Status just fails...
I have to use the X-Status
custom header because Safari overrides whatever message comes with the StatusText
...
Upvotes: 0
Views: 245
Reputation: 41997
The HTTP specification does not define a character encoding for header fields or the status line (well, not beyond US-ASCII). If you need non-ASCII characters, you're on your own. One reliable way is to percent-encode, for instance.
Also note that HTTP/2 doesn't have a status line, thus trying to use that to return information is a non-starter anyway.
Upvotes: 1