02 — Reading and writing¶
A string read from outside the program gets its encoding label from somewhere other than your code. This chapter is about where from — and about two things at the edges of a file that the label does not explain: a byte order mark at the start, and a \r at the end of every line.
| Lesson | The one thing |
|---|---|
What File.read returns depends on the locale |
US-ASCII under LC_ALL=C, and what -E does and does not fix |
| The BOM is kept unless you ask | BOM\|UTF-8, and the CSV header that is not "id" |
chomp knows about CRLF |
where Ruby parted from Perl, and where lines did not |