decode normalizes the input to UTF-8, using the BOM (if any) to detect UTF-16; defaults to UTF-8 when no BOM is present, stripping a UTF-8 BOM.
(raw []byte)
| 134 | // decode normalizes the input to UTF-8, using the BOM (if any) to detect |
| 135 | // UTF-16; defaults to UTF-8 when no BOM is present, stripping a UTF-8 BOM. |
| 136 | func decode(raw []byte) ([]byte, error) { |
| 137 | dec := unicode.BOMOverride(unicode.UTF8.NewDecoder()) |
| 138 | out, _, err := transform.Bytes(dec, raw) |
| 139 | return out, err |
| 140 | } |
| 141 | |
| 142 | // detectDelimiter inspects the header line and picks the delimiter (comma or |
| 143 | // tab) that appears more often outside of quoted fields. sigcheck's comma |