Skip to content

Commit e2508a7

Browse files
committed
Fix unicode in py 2
Extra prints More verbosity Change the way we detect unicode Fix wrong variable Force to string Remove extra prints
1 parent 3afce4e commit e2508a7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

frameioclient/utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,17 @@ def normalize_filename(fn):
9595
"""
9696
validchars = "-_.() "
9797
out = ""
98+
99+
if isinstance(fn, str):
100+
pass
101+
elif isinstance(fn, unicode):
102+
fn = str(fn.decode('utf-8', 'ignore'))
103+
else:
104+
pass
105+
98106
for c in fn:
99107
if str.isalpha(c) or str.isdigit(c) or (c in validchars):
100108
out += c
101109
else:
102110
out += "_"
103-
return out
111+
return out

0 commit comments

Comments
 (0)