sync: read UTF8 string, don't expect sane encoding from imported files, just force it
This commit is contained in:
parent
e126743d69
commit
492ab72dcd
2 changed files with 9 additions and 1 deletions
|
|
@ -81,7 +81,13 @@ func getFileContent(i Importer, URI string) (string, error) {
|
|||
if err := getFile(i, URI, bufio.NewWriter(io.Writer(&cnt))); err != nil {
|
||||
return "", err
|
||||
} else {
|
||||
return strings.TrimSpace(cnt.String()), nil
|
||||
// Ensure we read UTF-8 content.
|
||||
buf := make([]rune, 0)
|
||||
for b, _, err := cnt.ReadRune(); err == nil; b, _, err = cnt.ReadRune() {
|
||||
buf = append(buf, b)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(string(buf)), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue