[Python-3000] BOM handling

"Martin v. Löwis" martin at v.loewis.de
Mon Oct 2 22:32:41 CEST 2006


Blake Winton schrieb:
> Um, what more data do we need for this use-case?  I'm not going to 
> suggest an API, other than it would be nice if I didn't have to manually 
> figure out/hard code all the encodings.  (It's my belief that I will 
> currently have to do that, or at least special-case XML, to read the 
> encoding attribute.)  Oh, and it would be particularly horrible if I 
> output a shell script in UTF-8, and it included the BOM, since I believe 
> that would break the "magic number" of "#!".
> 
> (To test it in vim, set the following options:
> :set encoding=utf-8
> :set bomb
> )
> 
> Jennifer:~ bwinton$ xxd test
> 0000000: efbb bf23 2120 2f62 696e 2f62 6173 680a  ...#! /bin/bash.
> 0000010: 6563 686f 204a 7573 7420 7465 7374 696e  echo Just testin
> 0000020: 672e 2e2e 0a                             g....
> Jennifer:~ bwinton$ ./test
> -bash: ./test: cannot execute binary file

This works fine in Debian if you have the "utf8script" package
installed.

Regards,
Martin



More information about the Python-3000 mailing list