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