[modules/datetime] Add encoding for locale

When creating the date/time string, use the locale's preferred encoding
to format the string.

hopefully, this

fixes #158
This commit is contained in:
Tobias Witek 2017-08-12 16:44:17 +02:00
parent 474da05929
commit 8376e406e5

View file

@ -35,6 +35,7 @@ class Module(bumblebee.engine.Module):
locale.setlocale(locale.LC_TIME, lcl.split(".")) locale.setlocale(locale.LC_TIME, lcl.split("."))
def get_time(self, widget): def get_time(self, widget):
return datetime.datetime.now().strftime(self._fmt) enc = locale.getpreferredencoding()
return datetime.datetime.now().strftime(self._fmt).decode(enc)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4