New submission from Matthias Naegler <matthias.naeg...@gmail.com>:

```
# 0x0D, 13 = /r
# 0x0A, 10 = /n

print('test "\\r\\n"')
print('-------------')
b = bytes([0x41, 0x0D, 0x0A])
print("bytes: %s" % b)
print("string: %s" % b.decode('utf8'), end='')
# expected string: "A\r\n"
# ressult string: "A\r\r\n"

print('test "\\n"')
print('----------')
b = bytes([0x41, 0x0A])
print("bytes: %s" % b)
print("string: %s" % b.decode('utf8'), end='')
# expected string: "A\n"
# ressult string: "A\r\n"
```

It seems like bytes.decode always replaces "\n" with "\r\n".

Tested with
Windows 10 with Python:
- 3.6.0
- 3.7.7
- 3.8.3-rc1
- 3.8.3
- 2.7.18 (works as expected)

----------
components: Unicode, Windows
messages: 370711
nosy: Matthias Naegler, ezio.melotti, paul.moore, steve.dower, tim.golden, 
vstinner, zach.ware
priority: normal
severity: normal
status: open
title: bytes.decode changes/destroys line endings on windows
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40863>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to