INTRODUCING ensure_utf8_string, use it to fix BLOCKER bug for Gajim/Windows (#2392)
This commit is contained in:
parent
9bd4442784
commit
bd01e5719b
|
@ -534,6 +534,14 @@ def decode_string(string):
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
def ensure_utf8_string(string):
|
||||||
|
'''make sure string is in UTF-8'''
|
||||||
|
try:
|
||||||
|
string = decode_string(string).encode('utf-8')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return string
|
||||||
|
|
||||||
def get_windows_reg_env(varname, default=''):
|
def get_windows_reg_env(varname, default=''):
|
||||||
'''asks for paths commonly used but not exposed as ENVs
|
'''asks for paths commonly used but not exposed as ENVs
|
||||||
in english Windows 2003 those are:
|
in english Windows 2003 those are:
|
||||||
|
|
|
@ -681,9 +681,11 @@ class ConversationTextview:
|
||||||
if day_str:
|
if day_str:
|
||||||
format += day_str + ' '
|
format += day_str + ' '
|
||||||
format += '%X' + after_str
|
format += '%X' + after_str
|
||||||
# format comes as unicode, because of day_str.
|
tim_format = time.strftime(format, tim)
|
||||||
# we convert it to the encoding that we want
|
# if format comes as unicode because of day_str.
|
||||||
tim_format = time.strftime(format, tim).encode('utf-8')
|
# we convert it to the encoding that we want (and that is utf-8)
|
||||||
|
tim_format = helpers.ensure_utf8_string(tim_format)
|
||||||
|
tim_format = tim_format.encode('utf-8')
|
||||||
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 current_print_time == 'sometimes' and kind != 'info':
|
elif current_print_time == 'sometimes' and kind != 'info':
|
||||||
|
|
Loading…
Reference in New Issue