Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Switch to doing newline translation on Win32.
Now, \n always means \x0A by default (the newline pragma currently is still available, pending a decision from TimToady++ on its future). We translate \r\n on file/pipe input to \n, and \n to \r\n on output. We don't perform any such translation on sockets, nor on explict .encode and .decode calls (providing an escape hatch). \r\n remains a single grapheme, though you're now much less likely to run in to one. This brings us in line with how the problem has commonly been tackled in other languages; logical \n turned out not to work out so well in real life, even if avoiding the cost of boundary translation was nice. Note that we translate at grapheme, not codepoint, level, so a \r\n will never accidentally become \r\r\n (as can happen in some translation layers).
- Loading branch information