Skip to content

net/http: UTF in HTTP header field value #49627

Closed
@JonasJasas

Description

@JonasJasas

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

1.17.3

Does this issue reproduce with the latest release?

Yes

What did you do?

Using this: https://cs.opensource.google/go/go/+/refs/tags/go1.17.3:src/net/http/header.go;l=28

w.Header().Add("utf-test", "ąčęėįšųū„“ž")

What did you expect to see?

utf-test: %C4%85%C4%8D%C4%99%C4%97%C4%AF%C5%A1%C5%B3%C5%AB%E2%80%9E%E2%80%9C%C5%BE

What did you see instead?

utf-test: ����įšųū��ž

Current http/header implementation is automatically producing invalid HTTP requests if UTF is used in the header field value. So I guess it would be way better to use percent-encoding even though it is not in RFC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions