Skip to content

mime: use "charset=UTF-8" instead of "charset=utf-8" #19430

@jamshid

Description

@jamshid

What version of Go are you using (go version)?

go version go1.7 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/go"
GOTOOLDIR="/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build903236581=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

Not a big deal, the current code is not wrong, but please uppercase "UTF-8" in golang source.

Reference https://golang.org/src/mime/type.go, the map builtinTypesLower has some default Content-type's for file extensions like:

var builtinTypesLower = map[string]string{
...
		".xml":  "text/xml; charset=utf-8",
}

What did you expect to see?

                 ...
		".xml":  "text/xml; charset=UTF-8",

What did you see instead?

The charsets with "utf-8" should be spelled "UTF-8". The current lowercase version isn't necessarily wrong, but uppercase is more correct according to:
https://blog.codingoutloud.com/2009/04/08/is-utf-8-case-sensitive-in-xml-declaration/

This came up because the java server jetty uppercases the "utf-8" in the incoming request's Content-type charset before the servlet starts. Normally this isn't a problem, but it breaks S3-like signature verification, where client and server sign properties of a request (e.g. the Content-type header).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions