Detecting line endings
Fuzzyman
fuzzyman at gmail.com
Tue Feb 7 11:43:38 EST 2006
Alex Martelli wrote:
> Fuzzyman <fuzzyman at gmail.com> wrote:
> ...
> > > Open the file with 'rU' mode, and check the file object's newline
> > > attribute.
> >
> > Do you know if this works for multi-byte encodings ? Do files have
>
> You mean when you open them with the codecs module?
>
No, if I open a UTF16 encoded file in universal mode - will it still
have the correct lineending attribute ?
I can't open with a codec unless an encoding is explicitly supplied. I
still want to detect UTF16 even if the encoding isn't specified.
As I said, I ought to test this... Without metadata I wonder how Python
determines it ?
All the best,
Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
> > metadata associated with them showing the line-ending in use ?
>
> Not in the filesystems I'm familiar with (they did use to, in
> filesystems used on VMS and other ancient OSs, but that was a very long
> time ago).
>
>
> Alex
More information about the Python-list
mailing list