Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4469
| From | John Machin <sjmachin@lexicon.net> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: codec for UTF-8 with BOM |
| Date | 2011-05-02 03:13 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <eeed0fce-8900-4073-8383-73cb84ee696c@glegroupsg2000goo.googlegroups.com> (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