Skip to content

Commit

Permalink
Minor improvement to charsetReader
Browse files Browse the repository at this point in the history
  • Loading branch information
SlyMarbo committed Mar 15, 2014
1 parent bed23ab commit 2245994
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions charset-reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ func charsetReader(charset string, input io.Reader) (io.Reader, error) {
case isCharsetISO88591(charset):
return newCharsetISO88591(input), nil
default:
decoder := mahonia.NewDecoder(charset)
if decoder == nil {
goto invalidCharset
if decoder := mahonia.NewDecoder(charset); decoder != nil {
return decoder.NewReader(input), nil
}

return decoder.NewReader(input), nil
}

invalidCharset:
return nil, errors.New("CharsetReader: unexpected charset: " + charset)
}

Expand Down

0 comments on commit 2245994

Please sign in to comment.