Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4470
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2011-05-02 03:13 -0700 |
| Subject | Re: codec for UTF-8 with BOM |
| From | John Machin <sjmachin@lexicon.net> |
| Message-ID | <mailman.1069.1304331232.9059.python-list@python.org> (permalink) |
On Monday, 2 May 2011 19:47:45 UTC+10, Chris Rebert wrote:
> On Mon, May 2, 2011 at 1:34 AM, Ulrich Eckhardt
> <ulrich....@dominolaser.com> wrote:
> The correct name, as you found below and as is corroborated by the
> webpage, seems to be "utf_8_sig":
> >>> u"FOøbar".encode('utf_8_sig')
> '\xef\xbb\xbfFO\xc3\xb8bar'
To complete the picture, decoding swallows the BOM:
>>> '\xef\xbb\xbfFO\xc3\xb8bar'.decode('utf_8_sig')
u'FO\xf8bar'
Back to comp.lang.python | Previous | Next | Find similar
Re: codec for UTF-8 with BOM John Machin <sjmachin@lexicon.net> - 2011-05-02 03:13 -0700
csiph-web