#2185 fall back to use custom chardet lib
This commit is contained in:
parent
a62290de52
commit
4993ab1a76
8 changed files with 22 additions and 17 deletions
|
@ -246,8 +246,8 @@ func ParsePatch(maxlines int, reader io.Reader) (*Diff, error) {
|
|||
buf.WriteString("\n")
|
||||
}
|
||||
}
|
||||
charsetLabel := base.DetectEncoding(buf.Bytes())
|
||||
if charsetLabel != "UTF-8" {
|
||||
charsetLabel, err := base.DetectEncoding(buf.Bytes())
|
||||
if charsetLabel != "UTF-8" && err == nil {
|
||||
encoding, _ := charset.Lookup(charsetLabel)
|
||||
if encoding != nil {
|
||||
d := encoding.NewDecoder()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue