Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4470

Re: codec for UTF-8 with BOM

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <sjmachin@lexicon.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.054
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; '>>>': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'eckhardt': 0.16; 'rebert': 0.16; 'subject:UTF': 0.16; 'swallows': 0.16; 'cc:no real name:2**0': 0.20; 'seems': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'mon,': 0.22; "skip:' 40": 0.23; 'received:209.85.212': 0.25; 'correct': 0.26; 'chris': 0.27; 'cc:addr:python.org': 0.31; 'header:User-Agent:1': 0.35; 'received:209.85': 0.37; 'subject:with': 0.37; 'received:google.com': 0.38; 'cc:2**1': 0.38; 'received:209': 0.39; '2011': 0.62; 'below': 0.63; 'to:addr:googlegroups.com': 0.69; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'reply-to:addr:googlegroups.com': 0.93
Newsgroups comp.lang.python
Date Mon, 2 May 2011 03:13:44 -0700 (PDT)
In-Reply-To <mailman.1068.1304329675.9059.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=202.182.94.108; posting-account=Z4z4DAkAAAC4WdtPweJ4eFqqd33TUkvP
User-Agent G2/1.0
MIME-Version 1.0
Subject Re: codec for UTF-8 with BOM
From John Machin <sjmachin@lexicon.net>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org, Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To comp.lang.python@googlegroups.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.1069.1304331232.9059.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 82.94.164.166
X-Trace 1304331232 news.xs4all.nl 81485 [::ffff:82.94.164.166]:58443
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4470

Show key headers only | View raw


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


Thread

Re: codec for UTF-8 with BOM John Machin <sjmachin@lexicon.net> - 2011-05-02 03:13 -0700

csiph-web