[issue34256] Python treats ASCII record seperator ('\x1e') as a newline

Tim McNamara report at bugs.python.org
Sat Jul 28 06:14:39 EDT 2018


Tim McNamara <paperless at timmcnamara.co.nz> added the comment:

Hello,

I apologize if this is expected behavior, however it doesn't appear to be documented.

>>> "single\x1eline\x1estring".splitlines()
['single', 'line', 'string']

The glossary refers to the universal newlines as:


> universal newlines
>    A manner of interpreting text streams in which all of the 
>    following are recognized as ending a line: the Unix end-of-line
>    convention '\n', the Windows convention '\r\n', and the old 
>    Macintosh convention '\r'. See PEP 278 and PEP 3116, as well as 
>    bytes.splitlines() for an additional use.
https://docs.python.org/3/glossary.html#term-universal-newlines

According to Wikipedia, pre-POSIX QNX uses `\x1e` as a newline (https://en.wikipedia.org/wiki/Newline#Representation), but I don't think that it should be treated as the default.

----------
title: Python treats ASCII record seperator ('\x1e as a newline -> Python treats ASCII record seperator ('\x1e') as a newline

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34256>
_______________________________________


More information about the Python-bugs-list mailing list