Prev: eric 5.0.0 released
Next: ImportError: DLL load failed: The specified module could not be found, SWIG, life, etc
From: Antoine Pitrou on 5 Jul 2010 09:35 On Mon, 5 Jul 2010 06:17:38 -0700 (PDT) norbert <ncauderan(a)gmail.com> wrote: > > a FileHandler works as expected, the log file being UTF-8 encoded. Ouch. Implicit encoding sounds like a bad behaviour. > The > SMTPHandler is the only logger I know with this problem, maybe > connected to SMTPLib implementation ? I suggest you report an issue on http://bugs.python.org
From: Chris Withers on 5 Jul 2010 13:21 Antoine Pitrou wrote: > On Mon, 5 Jul 2010 06:17:38 -0700 (PDT) > norbert <ncauderan(a)gmail.com> wrote: >> a FileHandler works as expected, the log file being UTF-8 encoded. > > Ouch. Implicit encoding sounds like a bad behaviour. Yes indeed, hence my question on python-dev... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
From: norbert on 5 Jul 2010 16:49 > > Ouch. Implicit encoding sounds like a bad behaviour. Looking at the FileHandler source ( http://svn.python.org/view/python/trunk/Lib/logging/__init__.py?view=markup ) : the utf-8 encoding is a fallback. But *FileHandler family let you specify the encoding you want, so that's OK I think. But SMTPHandler does not have such a thing it sends its email with : msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % ( self.fromaddr, ",".join(self.toaddrs), self.getSubject(record), formatdate(), msg) .... smtp.sendmail(from,to,msg) And there is no encoding in all this. It seems pretty dangerous to me (so my first post) because your application will work without any problem with a FileHandler and the day you'll decide to send email in case of serious problem, it will crash with a UnicodeError. I can't see any workaround, except by subclassing SMTPHandler's emit method to be unicode-aware or at least URF-8 aware.
From: Vinay Sajip on 6 Jul 2010 02:22 On Jul 5, 2:35 pm, Antoine Pitrou <solip...(a)pitrou.net> wrote: > > a FileHandler works as expected, the log file being UTF-8 encoded. > > Ouch. Implicit encoding sounds like a bad behaviour. UTF-8 is only used as a fallback in an exception handler, you can use any supported encoding using the encoding= keyword argument to a FileHandler. > > I suggest you report an issue onhttp://bugs.python.org Yes, please do that and I will investigate. Regards, Vinay Sajip
From: norbert on 8 Jul 2010 18:20
On Jul 5, 3:35 pm, Antoine Pitrou <solip...(a)pitrou.net> wrote: > I suggest you report an issue onhttp://bugs.python.org done : http://bugs.python.org/issue9208 |