Golang Fprintf render strange character
I have the following code:
package main
import (
"fmt"
"github.com/gorilla/mux"
"net/http"
"time"
)
func showText(w http.ResponseWriter, r *http.Request) {
text := "WASHINGTON — Huddled in a command center on Wednesday afternoon."
w.Header().Set("Content-Type", "text/html")
_, _ = fmt.Fprintf(w, text)
}
func main() {
// Create router
r := mux.NewRouter()
r.HandleFunc("/", showText)
http.Handle("/", r)
srv := &http.Server{
Handler: r,
Addr: "127.0.0.1:8000",
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
err := srv.ListenAndServe()
must(err)
}
But when going to 127.0.0.1:8000
, I see the following:
WASHINGTON — Huddled in a command center on Wednesday afternoon.
It seems that the character "—" has become — for some reason. Is there any way to overcome this?