Commit 68d647b4 authored by echel0n's avatar echel0n
Browse files

Fixed encoding/decoding unicode issues with tuples and kludge

parent 394338f4
# Changelog
- * a36503f - 2017-11-05: Fixed encoding/decoding unicode issues with tuples and kludge
- * 11d9098 - 2017-11-05: Fixed encoding/decoding unicode issues with tuples and kludge
- * 394338f - 2017-11-05: Fixed encoding/decoding unicode issues with tuples and kludge
- * c12b19d - 2017-11-05: Fixed issue #109 - AmbiguousTimeError Fixed issue #108 - Post-Processing issues due to unicode directory and file names
- * 02e5733 - 2017-11-05: fixed post-processor queue issues with none types
- * 0c46c22 - 2017-11-05: fixed post-processor queue issues with none types
......
......@@ -71,7 +71,7 @@ def ek(f):
result = f(*[ss(x) if isinstance(x, six.string_types) else x for x in args], **kwargs)
if isinstance(result, types.GeneratorType):
result = tuple(result)
return fix_generator_encoding(result)
if isinstance(result, (list, tuple)):
return fix_list_encoding(result)
if isinstance(result, str):
......@@ -117,19 +117,28 @@ def fix_list_encoding(var):
:return: Unicode converted input
"""
if isinstance(var, list):
if isinstance(var, (list, tuple)):
var = filter(lambda x: x is not None, map(to_unicode, var))
elif isinstance(var, tuple):
new_var = list(var)
for i, tup in enumerate(var):
temp = []
for x in tup:
temp.append(fix_list_encoding(x))
new_var[i] = tuple(temp)
var = tuple(new_var)
return var
def fix_generator_encoding(gen):
"""
Converts each item in a list to Unicode
:param var: List or tuple to convert to Unicode
:return: Unicode converted input
"""
result = list(gen)
for i, item in enumerate(result):
temp = []
for x in item:
temp.append(fix_list_encoding(x))
result[i] = type(item)(temp)
return result
def to_unicode(var):
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment