Update XML encoding regex to take single quotes into consideration
This commit is contained in:
parent
266d97ad63
commit
82e08d0f69
3 changed files with 6219 additions and 1 deletions
|
@ -15,7 +15,7 @@ import (
|
|||
"golang.org/x/net/html/charset"
|
||||
)
|
||||
|
||||
var xmlEncodingRegex = regexp.MustCompile(`<\?xml(.*)encoding="(.+)"(.*)\?>`)
|
||||
var xmlEncodingRegex = regexp.MustCompile(`<\?xml(.*)encoding=["'](.+)["'](.*)\?>`)
|
||||
|
||||
// Response wraps a server response.
|
||||
type Response struct {
|
||||
|
|
|
@ -124,6 +124,7 @@ func TestEnsureUnicodeWithHTMLDocuments(t *testing.T) {
|
|||
{"charset-content-type-xml-iso88591.xml", "application/rss+xml; charset=ISO-8859-1", false},
|
||||
{"windows_1251.xml", "text/xml", false},
|
||||
{"smallfile.xml", "text/xml; charset=utf-8", true},
|
||||
{"single_quote_xml_encoding.xml", "text/xml; charset=utf-8", true},
|
||||
}
|
||||
|
||||
for _, tc := range unicodeTestCases {
|
||||
|
|
6217
http/client/testdata/single_quote_xml_encoding.xml
vendored
Normal file
6217
http/client/testdata/single_quote_xml_encoding.xml
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue