aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/csv/reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/csv/reader.go')
-rw-r--r--src/encoding/csv/reader.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/encoding/csv/reader.go b/src/encoding/csv/reader.go
index 1350f3ebdd..2efc7ad094 100644
--- a/src/encoding/csv/reader.go
+++ b/src/encoding/csv/reader.go
@@ -224,6 +224,10 @@ func (r *Reader) readLine() ([]byte, error) {
}
if len(line) > 0 && err == io.EOF {
err = nil
+ // For backwards compatibility, drop trailing \r before EOF.
+ if line[len(line)-1] == '\r' {
+ line = line[:len(line)-1]
+ }
}
r.numLine++
// Normalize \r\n to \n on all input lines.