strftime returns local-encoded string. decode it. Fixes #1662
This commit is contained in:
parent
e8f810f7cb
commit
743d514997
|
@ -31,6 +31,7 @@ import gtkgui_helpers
|
|||
import message_control
|
||||
import dialogs
|
||||
import history_window
|
||||
import locale
|
||||
|
||||
from common import gajim
|
||||
from common import helpers
|
||||
|
@ -477,7 +478,8 @@ class ChatControlBase(MessageControl):
|
|||
buffer = conv_textview.get_buffer()
|
||||
end_iter = buffer.get_end_iter()
|
||||
tim = time.localtime()
|
||||
tim_format = time.strftime('%H:%M', tim)
|
||||
tim_format = time.strftime('%H:%M', tim).decode(
|
||||
locale.getpreferredencoding())
|
||||
buffer.insert_with_tags_by_name(end_iter, '\n' + tim_format,
|
||||
'time_sometimes')
|
||||
# scroll to the end of the textview
|
||||
|
|
|
@ -579,7 +579,8 @@ class ConversationTextview(gtk.TextView):
|
|||
if day_str:
|
||||
format += day_str + ' '
|
||||
format += '%X' + after_str
|
||||
tim_format = time.strftime(format, tim)
|
||||
tim_format = time.strftime(format, tim).decode(
|
||||
locale.getpreferredencoding())
|
||||
buffer.insert_with_tags_by_name(end_iter, tim_format + ' ',
|
||||
*other_tags_for_time)
|
||||
elif gajim.config.get('print_time') == 'sometimes':
|
||||
|
@ -589,7 +590,8 @@ class ConversationTextview(gtk.TextView):
|
|||
if seconds_passed > every_foo_seconds:
|
||||
self.last_time_printout = time.mktime(tim)
|
||||
end_iter = buffer.get_end_iter()
|
||||
tim_format = time.strftime('%H:%M', tim)
|
||||
tim_format = time.strftime('%H:%M', tim).decode(
|
||||
locale.getpreferredencoding())
|
||||
buffer.insert_with_tags_by_name(end_iter, tim_format + '\n',
|
||||
'time_sometimes')
|
||||
other_text_tag = self.detect_other_text_tag(text, kind)
|
||||
|
|
|
@ -23,6 +23,7 @@ import signal
|
|||
import gtk
|
||||
import gtk.glade
|
||||
import time
|
||||
import locale
|
||||
|
||||
import exceptions
|
||||
import dialogs
|
||||
|
@ -265,7 +266,8 @@ class HistoryManager:
|
|||
# but store in liststore log_line_id, jid_id, time, message and subject
|
||||
time_ = row[2]
|
||||
try:
|
||||
time_ = time.strftime('%x', time.localtime(float(time_)))
|
||||
time_ = time.strftime('%x', time.localtime(float(time_))).decode(
|
||||
locale.getpreferredencoding())
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
|
@ -290,7 +292,8 @@ class HistoryManager:
|
|||
# but store in liststore log_line_id, jid_id, time, message and subject
|
||||
time_ = row[2]
|
||||
try:
|
||||
time_ = time.strftime('%x', time.localtime(float(time_)))
|
||||
time_ = time.strftime('%x', time.localtime(float(time_))).decode(
|
||||
locale.getpreferredencoding())
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
|
@ -419,7 +422,8 @@ class HistoryManager:
|
|||
|
||||
message = row[2]
|
||||
try:
|
||||
time_ = time.strftime('%x', time.localtime(float(time_)))
|
||||
time_ = time.strftime('%x', time.localtime(float(time_))).decode(
|
||||
locale.getpreferredencoding())
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import sys
|
|||
import time
|
||||
import gtkgui_helpers
|
||||
import dialogs
|
||||
import locale
|
||||
|
||||
from common import helpers
|
||||
from common import gajim
|
||||
|
@ -321,7 +322,7 @@ class VcardWindow:
|
|||
stats += ': ' + c.status
|
||||
if c.last_status_time:
|
||||
stats += '\n' + _('since %s') % time.strftime('%c',
|
||||
c.last_status_time)
|
||||
c.last_status_time).decode(locale.getpreferredencoding())
|
||||
one = False
|
||||
status_label = self.xml.get_widget('status_label')
|
||||
status_label.set_max_width_chars(15)
|
||||
|
|
Loading…
Reference in New Issue