mirror of
https://github.com/golang/go
synced 2024-11-25 10:38:00 -07:00
encoding/csv: clarify that Writer uses different line break than RFC 4180
Package documentation of encoding/csv says:
> this package supports the format described in RFC 4180.
https://pkg.go.dev/encoding/csv#section-documentation
According to section 2 of RFC 4180:
> Each record is located on a separate line, delimited by a line break (CRLF).
https://www.rfc-editor.org/rfc/rfc4180.html#section-2
On the other hand, encoding/csv.Writer uses LF (not CRLF) as newline character by default.
> If [Writer.UseCRLF] is true, the Writer ends each output line with \r\n instead of \n.
https://pkg.go.dev/encoding/csv#Writer
1259a30a58/src/encoding/csv/writer.go (L115-L119)
Strictly speaking, this behavior is different from RFC 4180.
Package documentation would improve if we clarify that point.
This commit is contained in:
parent
4721f95058
commit
489167eb04
@ -4,7 +4,8 @@
|
||||
|
||||
// Package csv reads and writes comma-separated values (CSV) files.
|
||||
// There are many kinds of CSV files; this package supports the format
|
||||
// described in RFC 4180.
|
||||
// described in RFC 4180, except that [Writer] uses LF
|
||||
// instead of CRLF as newline character by default.
|
||||
//
|
||||
// A csv file contains zero or more records of one or more fields per record.
|
||||
// Each record is separated by the newline character. The final record may
|
||||
|
Loading…
Reference in New Issue
Block a user