diff --git a/internal/pkg/output/record_writer_csv_colorizer.go b/internal/pkg/output/record_writer_csv_colorizer.go index a602ae790..43434e643 100644 --- a/internal/pkg/output/record_writer_csv_colorizer.go +++ b/internal/pkg/output/record_writer_csv_colorizer.go @@ -45,7 +45,6 @@ import ( "bufio" "errors" "strings" - "unicode" "unicode/utf8" "github.com/johnkerl/miller/internal/pkg/colorizer" @@ -173,6 +172,8 @@ func validDelim(r rune) bool { // fieldNeedsQuotes reports whether our field must be enclosed in quotes. // Fields with a Comma, fields with a quote or newline, and // fields which start with a space must be enclosed in quotes. +// [NOTE: https://www.rfc-editor.org/rfc/rfc4180 doesn't specify this so Miller +// does not use this.] // We used to quote empty strings, but we do not anymore (as of Go 1.4). // The two representations should be equivalent, but Postgres distinguishes // quoted vs non-quoted empty string during database imports, and it has @@ -205,6 +206,8 @@ func fieldNeedsQuotes(field string, comma rune) bool { } } - r1, _ := utf8.DecodeRuneInString(field) - return unicode.IsSpace(r1) + // Not used by Miller as noted above + // r1, _ := utf8.DecodeRuneInString(field) + // return unicode.IsSpace(r1) + return false } diff --git a/test/cases/io-rfc-csv/0019/cmd b/test/cases/io-rfc-csv/0019/cmd new file mode 100644 index 000000000..4b8080795 --- /dev/null +++ b/test/cases/io-rfc-csv/0019/cmd @@ -0,0 +1 @@ +mlr --csv cat ${CASEDIR}/input diff --git a/test/cases/io-rfc-csv/0019/experr b/test/cases/io-rfc-csv/0019/experr new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/io-rfc-csv/0019/expout b/test/cases/io-rfc-csv/0019/expout new file mode 100644 index 000000000..053905885 --- /dev/null +++ b/test/cases/io-rfc-csv/0019/expout @@ -0,0 +1,2 @@ +a,b,c +leading, space,should not be double-quoted diff --git a/test/cases/io-rfc-csv/0019/input b/test/cases/io-rfc-csv/0019/input new file mode 100644 index 000000000..053905885 --- /dev/null +++ b/test/cases/io-rfc-csv/0019/input @@ -0,0 +1,2 @@ +a,b,c +leading, space,should not be double-quoted