A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-September/074811.html below:

New lines, carriage returns, and Windows

[Python-Dev] [python] Re: New lines, carriage returns, and WindowsMichael Foord fuzzyman at voidspace.org.uk
Sun Sep 30 15:49:56 CEST 2007
skip at pobox.com wrote:
>     Michael> Actually, I usually get these strings from Windows UI
>     Michael> components. A file containing '\r\n' is read in with '\r\n'
>     Michael> being translated to '\n'. New user input is added containing
>     Michael> '\r\n' line endings. The file is written out and now contains a
>     Michael> mix of '\r\n' and '\r\r\n'.
>
> So you need a translation layer between the UI component and your code.
> Treat the component as a text file and perform the desired mapping.  Yes?
>
>   

Actually the problem was reported by one of the IronPython developers on 
behalf of another user. We stick to using the .NET file I/O and so don't 
have a problem. The only time it is an issue for us is our tests, where 
we have string literals in our test code (where new lines are obviously 
'\n') and we do a manual 'replace'. Not very difficult.

It is just slightly ironic that the time Python 'gets it wrong' (for 
some value of wrong) is when you are using text mode for I/O :-)

Michael

> Skip
>
>   

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4