blob: ea24bf809c7df7e7b9804a815b29c55219a6f004 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright 2019 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package xml // import "miniflux.app/reader/xml"
import (
"encoding/xml"
"fmt"
"strings"
"testing"
)
func TestIllegalCharacters(t *testing.T) {
type myxml struct {
XMLName xml.Name `xml:"rss"`
Version string `xml:"version,attr"`
Title string `xml:"title"`
}
data := fmt.Sprintf(`<?xml version="1.0" encoding="windows-1251"?><rss version="2.0"><title>%s</title></rss>`, "\x10")
var x myxml
decoder := NewDecoder(strings.NewReader(data))
err := decoder.Decode(&x)
if err != nil {
t.Error(err)
}
}
|