Skip to content

Commit

Permalink
Sets the encoding for web server responses.
Browse files Browse the repository at this point in the history
The encoding needed to be set to UTF-8 for correct display of non-ASCII
characters.
  • Loading branch information
gonzalop committed Jun 6, 2024
1 parent b1b41d6 commit 503eada
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (ls *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
keys := maps.Keys(page)
sort.Strings(keys)
w.Header().Set("Content-Type", "text/plain")
w.Header().Set("Content-Type", "text/plain; charset=UTF-8")
for _, k := range keys {
_, _ = w.Write([]byte(fmt.Sprintf("%s: %v\n", k, page[k])))
}
Expand Down

0 comments on commit 503eada

Please sign in to comment.