Read file that starts with '\xff\xfe'

Gerhard Häring gh at ghaering.de
Mon Sep 8 08:13:36 EDT 2003


Bob Gailer wrote:
> On Win 2K the Task Scheduler writes a log file that appears to be 
> encoded. The first line is:
> 
> '\xff\xfe"\x00T\x00a\x00s\x00k\x00 
> \x00S\x00c\x00h\x00e\x00d\x00u\x00l\x00e\x00r\x00 
> \x00S\x00e\x00r\x00v\x00i\x00c\x00e\x00"\x00\r\x00\n'

I wrote that into a file, and used the 'file' utility from Cygwin, which 
tells me:

$ file t
t: Little-endian UTF-16 Unicode character data, with CR line terminators

AFAIK the codecs module doesn't have autodetection of codecs.

HTH,

-- Gerhard





More information about the Python-list mailing list