Re: logging of strings with broken encoding

2009-07-03 Thread Lie Ryan
Thomas Guettler wrote: > Stefan Behnel schrieb: >> Thomas Guettler wrote: >>> My quick fix is this: >>> >>> class MyFormatter(logging.Formatter): >>> def format(self, record): >>> msg=logging.Formatter.format(self, record) >>> if isinstance(msg, str): >>> msg=msg.dec

Re: logging of strings with broken encoding

2009-07-03 Thread Thomas Guettler
Stefan Behnel schrieb: > Thomas Guettler wrote: >> My quick fix is this: >> >> class MyFormatter(logging.Formatter): >> def format(self, record): >> msg=logging.Formatter.format(self, record) >> if isinstance(msg, str): >> msg=msg.decode('utf8', 'replace') >>

Re: logging of strings with broken encoding

2009-07-02 Thread Lie Ryan
Thomas Guettler wrote: > My quick fix is this: > > class MyFormatter(logging.Formatter): > def format(self, record): > msg=logging.Formatter.format(self, record) > if isinstance(msg, str): > msg=msg.decode('utf8', 'replace') > return msg > > But I still thi

Re: logging of strings with broken encoding

2009-07-02 Thread Stefan Behnel
Thomas Guettler wrote: > My quick fix is this: > > class MyFormatter(logging.Formatter): > def format(self, record): > msg=logging.Formatter.format(self, record) > if isinstance(msg, str): > msg=msg.decode('utf8', 'replace') > return msg > > But I still thi

Re: logging of strings with broken encoding

2009-07-02 Thread Thomas Guettler
My quick fix is this: class MyFormatter(logging.Formatter): def format(self, record): msg=logging.Formatter.format(self, record) if isinstance(msg, str): msg=msg.decode('utf8', 'replace') return msg But I still think handling of non-ascii byte strings shoul

Re: logging of strings with broken encoding

2009-07-02 Thread Lie Ryan
Thomas Guettler wrote: > Hi, > > I have bug in my code, which results in the same error has this one: > > https://bugs.launchpad.net/bzr/+bug/295653 > {{{ > Traceback (most recent call last): > File "/usr/lib/python2.6/logging/__init__.py", line 765, in emit > self.stream.write(fs % msg.enc

Re: logging of strings with broken encoding

2009-07-02 Thread Peter Otten
Thomas Guettler wrote: > I have bug in my code, which results in the same error has this one: > > https://bugs.launchpad.net/bzr/+bug/295653 > {{{ > Traceback (most recent call last): > File "/usr/lib/python2.6/logging/__init__.py", line 765, in emit > self.stream.write(fs % msg.encode("UTF

Re: logging of strings with broken encoding

2009-07-02 Thread David Smith
Thomas Guettler wrote: > Hi, > > I have bug in my code, which results in the same error has this one: > > https://bugs.launchpad.net/bzr/+bug/295653 > {{{ > Traceback (most recent call last): > File "/usr/lib/python2.6/logging/__init__.py", line 765, in emit > self.stream.write(fs % msg.enc

logging of strings with broken encoding

2009-07-02 Thread Thomas Guettler
Hi, I have bug in my code, which results in the same error has this one: https://bugs.launchpad.net/bzr/+bug/295653 {{{ Traceback (most recent call last): File "/usr/lib/python2.6/logging/__init__.py", line 765, in emit self.stream.write(fs % msg.encode("UTF-8")) .. UnicodeDecodeError: 'a