Re: codecs.open on Win32 -- converting my newlines to CR+LF

2009-08-27 Thread Chris Rebert
On Wed, Aug 26, 2009 at 11:06 PM, Chris Rebertc...@rebertia.com wrote: On Wed, Aug 26, 2009 at 8:40 PM, Ryan McGuireuse...@enigmacurry.com wrote: On Aug 26, 11:04 pm, Philip Semanchuk phi...@semanchuk.com wrote: Try using rb instead of r for the mode in the call to open(). HTH Philip That

Re: codecs.open on Win32 -- converting my newlines to CR+LF

2009-08-27 Thread Chris Rebert
On Wed, Aug 26, 2009 at 8:40 PM, Ryan McGuireuse...@enigmacurry.com wrote: On Aug 26, 11:04 pm, Philip Semanchuk phi...@semanchuk.com wrote: Try using rb instead of r for the mode in the call to open(). HTH Philip That does indeed fix the problem, thanks! Still seems like the docs are

codecs.open on Win32 -- converting my newlines to CR+LF

2009-08-26 Thread Ryan McGuire
I've got a UTF-8 encoded text file from Linux with standard newlines (\n). I'm reading this file on Win32 with Python 2.6: codecs.open(whatever.txt,r,utf-8).read() Inexplicably, all the newlines (\n) are replaced with CR+LF (\r \n) ... Why? As a workaround I'm having to do this:

Re: codecs.open on Win32 -- converting my newlines to CR+LF

2009-08-26 Thread Philip Semanchuk
On Aug 26, 2009, at 10:52 PM, Ryan McGuire wrote: I've got a UTF-8 encoded text file from Linux with standard newlines (\n). I'm reading this file on Win32 with Python 2.6: codecs.open(whatever.txt,r,utf-8).read() Inexplicably, all the newlines (\n) are replaced with CR+LF (\r \n) ... Why?

Re: codecs.open on Win32 -- converting my newlines to CR+LF

2009-08-26 Thread Ryan McGuire
On Aug 26, 11:04 pm, Philip Semanchuk phi...@semanchuk.com wrote: Try using rb instead of r for the mode in the call to open(). HTH Philip That does indeed fix the problem, thanks! Still seems like the docs are wrong though. -- http://mail.python.org/mailman/listinfo/python-list