fix: get valid UTF-8 for diff_hunk and composer readme (#39932)

* Fixes #39929
* Fixes #39994

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-10-24 15:17:08 +02:00
1 parent 4f744d15be
commit ce7364e215
11 files changed
+62 -65

No files matched your search

+1 -1
View File
@@ -114,7 +114,7 @@ func (b *Base) HTTPError(status int, contents ...string) {
func (b *Base) JSON(status int, content any) {
b.Resp.Header().Set("Content-Type", "application/json;charset=utf-8")
b.Resp.WriteHeader(status)
if err := json.MarshalWrite(b.Resp, content); err != nil {
if err := json.MarshalWriteRelaxed(b.Resp, content); err != nil {
log.Error("Render JSON failed: %v", err)
}
}