Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36595
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Why BOM in logging message? |
| Date | 2013-01-10 18:45 -0500 |
| References | <kcksg2$bkp$1@panix2.panix.com> <mailman.344.1357772847.2939.python-list@python.org> <roy-10B053.20174309012013@news.panix.com> <kcmoug$rk4$1@panix2.panix.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.383.1357861568.2939.python-list@python.org> (permalink) |
On 1/10/2013 11:06 AM, Roy Smith wrote:
> Well, this is fascinating. It turns out that while all of our
> machines report that they're running 2.7.3, they have two different
> versions of /usr/lib/python2.7/logging/handlers.py!
>
> -rw-r--r-- 1 root root 45076 Aug 1 05:39 /usr/lib/python2.7/logging/handlers.py
> -rw-r--r-- 1 root root 45143 Apr 20 2012 /usr/lib/python2.7/logging/handlers.py
>
> The April 24th version has the BOM code in SysLogHander.emit():
The 'BOM' you are discussing here is not a true 2 or 4 byte
byte-order-mark, but the pseudo-BOM (pseudo because a stream of single
bytes has no byte order within the single bytes) that Micro$tupid adds
(sometimes) to utf-8 encoded bytes to mark their encoding as utf-8
rather than anything else. In otherwords, it is a non-(anti-)standard
U(nicode)E(ncoding)M(ark). It is actually the utf-8 encoding of the
2-byte BOM, and hence not a single mark! It is really confusing when
people use 'BOM' to refer to a UEM sequence instead of a BOM.
> | # Message is a string. Convert to bytes as required by RFC 5424
> | if type(msg) is unicode:
> | msg = msg.encode('utf-8')
> | if codecs:
> | msg = codecs.BOM_UTF8 + msg
> | msg = prio + msg
2.7.3 was released in April.
> and the August 1st version doesn't:
>
> | # Message is a string. Convert to bytes as required by RFC 5424
> | if type(msg) is unicode:
> | msg = msg.encode('utf-8')
> | msg = prio + msg
The issue referenced in an earlier messaged was to remove the UEM where
it did not belong.
> Is it possible there's two different 2.7.3 builds that somehow got
> packaged by Ubuntu at different times?
As you discovered, Ubuntu sometimes updates a release with bug patches
before we release a new official bugfix release. 2.7.4, with many
bugfixes, is still to see the light of day.
> The pattern of which machines
> have the August code and which have the April code correlates with
> when we rolled out each server instance.
Great detective work ;-).
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why BOM in logging message? roy@panix.com (Roy Smith) - 2013-01-09 17:54 -0500
Re: Why BOM in logging message? Chris Angelico <rosuav@gmail.com> - 2013-01-10 10:07 +1100
Re: Why BOM in logging message? Roy Smith <roy@panix.com> - 2013-01-09 20:17 -0500
Re: Why BOM in logging message? roy@panix.com (Roy Smith) - 2013-01-10 11:06 -0500
Re: Why BOM in logging message? Chris Angelico <rosuav@gmail.com> - 2013-01-11 03:16 +1100
Re: Why BOM in logging message? roy@panix.com (Roy Smith) - 2013-01-10 11:40 -0500
Re: Why BOM in logging message? Chris Angelico <rosuav@gmail.com> - 2013-01-11 03:52 +1100
Re: Why BOM in logging message? Terry Reedy <tjreedy@udel.edu> - 2013-01-10 18:45 -0500
Re: Why BOM in logging message? John Gordon <gordon@panix.com> - 2013-01-09 23:19 +0000
Re: Why BOM in logging message? Roy Smith <roy@panix.com> - 2013-01-09 20:17 -0500
csiph-web