aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/xml.go
diff options
context:
space:
mode:
authorGiulio Iotti <dullgiulio@gmail.com>2015-08-31 19:08:49 +0300
committerRuss Cox <rsc@golang.org>2015-11-25 17:09:28 +0000
commit0b55be1ba2cf1cbb84ef4292942e6532df0b22ad (patch)
tree2c614253491db4f5bf1cc8fb5349a61857cac77a /src/encoding/xml/xml.go
parent97c859f8da0c85c33d0f29ba5e11094d8e691e87 (diff)
downloadgo-0b55be1ba2cf1cbb84ef4292942e6532df0b22ad.tar.xz
encoding/xml: case-insensitive encoding recognition
From the XML spec: "XML processors should match character encoding names in a case-insensitive way" Fixes #12417. Change-Id: I678c50152a49c14364be62b3f21ab9b9b009b24b Reviewed-on: https://go-review.googlesource.com/14084 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/encoding/xml/xml.go')
-rw-r--r--src/encoding/xml/xml.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/encoding/xml/xml.go b/src/encoding/xml/xml.go
index bdd607cfa8..70ff877172 100644
--- a/src/encoding/xml/xml.go
+++ b/src/encoding/xml/xml.go
@@ -583,7 +583,7 @@ func (d *Decoder) rawToken() (Token, error) {
return nil, d.err
}
enc := procInst("encoding", content)
- if enc != "" && enc != "utf-8" && enc != "UTF-8" {
+ if enc != "" && enc != "utf-8" && enc != "UTF-8" && !strings.EqualFold(enc, "utf-8") {
if d.CharsetReader == nil {
d.err = fmt.Errorf("xml: encoding %q declared but Decoder.CharsetReader is nil", enc)
return nil, d.err