More consistent '\r' and '\n' handling