The `getline` function tries to handle different line ending
styles (carriage returns, new lines, a mix of both). For that it has
to probe one more character after having found one of them. If that
probed character is not one of them, then the previous position has to
be restored — and that was wrongfully assuming that each character is
only one byte long. Which it isn't.
Fixes#2160.