Issue1812913

classification
Title: File read converts \r to \n
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: abarua, pjenvey
Priority: normal Keywords:

Created on 2007-10-13.16:18:45 by abarua, last changed 2007-10-13.23:24:30 by pjenvey.

Messages
msg1972 (view) Author: Arunabh Barua (abarua) Date: 2007-10-13.16:18:45
When reading a file with for example: open('test.txt').read() - converts \r characters to \n. To reproduce the following code helps:

#Create a test file
test_string='\r'
f=open('test.txt','w')
f.write(test_string)
f.close()
#Read data contents
open('test.txt').read()

In CPython the last statement results in \r (correct) while in Jython it results in \n.
msg1973 (view) Author: Philip Jenvey (pjenvey) Date: 2007-10-13.23:24:30
This is already fixed on trunk. This is too big of a change in behavior to merge over to the branch, unfortunately.

Jython has always been this way, basically acting like universal newlines is enabled (sort of) by default. though the next major revision will be better; trunk now works exactly like CPython in terms of newline conversion (and supports a separate universal newlines mode)
History
Date User Action Args
2007-10-13 16:18:45abaruacreate