Description
- Gitea version: 1.14.0+dev-629-gd1353e1f7
- Operating system: Windows 10
- Can you reproduce the bug at https://try.gitea.io:
Description
When decoding the response from https://try.gitea.io/api/v1/version with .NET code _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
an exception is thrown because the charset utf8
is invalid. The Gitea test server responds with the following HTTP headers:
Content-Length: 40
Content-Type: application/json; charset=utf8
According to the W3C, which is referring to the IANA the charset is specified as UTF-8
. When manually modifying the received header to application/json; charset=utf-8
, decoding works fine and no exception is thrown.
When working with my local test server, which is behind a reverse-proxy, the API is also working fine, because the proxy is "sanitizing" the character set:
content-type: application/json; charset=UTF-8
content-encoding: gzip
If you agree with my observation that the charset should be UTF-8
or utf-8
(containing a dash), please consider changing the character set for one of the upcoming releases to be standard compliant.
Without any further knowledge about Gitea or golang, two of the possibly affected locations are:
gitea/modules/context/context.go
Line 359 in 99b7af6
gitea/modules/context/context.go
Line 324 in 99b7af6