On Thu, Nov 20, 2014 at 8:40 PM, Francis Moreau <francis.m...@gmail.com> wrote:
> My question is: how should this be fixed properly ?
>
> A simple solution would be to force all strings passed to the
> logger to be unicode:
>
>   log.debug(u"%s: %s" % ...)
>
> and more generally force all string in my code to be unicode by
> using the 'u' prefix.

Yep. And then you may want to consider "from __future__ import
unicode_literals", which will make string literals represent Unicode
strings rather than byte strings. Basically the same as you're saying,
only without the explicit u prefixes.

This will also make your Py2 code behave more like the way your Py3
code does (as bare string literals are always Unicode strings in Py3).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to