This commit is contained in:
Loic Nageleisen 2015-06-30 11:48:44 +02:00
parent 44c907a4bd
commit 7669bda5f6

View file

@ -19,6 +19,7 @@ type Fixer struct {
allowControl bool allowControl bool
handleCP1252 bool handleCP1252 bool
handleISO_8859_15 bool handleISO_8859_15 bool
// TODO: fix or reject overlong utf8 sequences
} }
func AllowControl(f *Fixer) error { func AllowControl(f *Fixer) error {
@ -182,7 +183,7 @@ func Fix(r io.Reader, w io.Writer, options ...func(*Fixer) error) {
continue continue
} }
// convert ISO-8859-1 to UTF-8 // ISO-8859-1
if input[0] >= 0x80 && input[0] <= 0xFF { if input[0] >= 0x80 && input[0] <= 0xFF {
bytes := []byte(string(rune(input[0]))) bytes := []byte(string(rune(input[0])))
for _, b := range bytes { for _, b := range bytes {