summaryrefslogtreecommitdiff
path: root/alot/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/helper.py')
-rw-r--r--alot/helper.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/alot/helper.py b/alot/helper.py
index 400d8c0e..db37f34d 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -41,7 +41,7 @@ def split_commandline(s, comments=False, posix=True):
s = s.replace('\'', '\\\'')
s = s.replace('\"', '\\\"')
# encode s to utf-8 for shlex
- if isinstance(s, unicode):
+ if isinstance(s, str):
s = s.encode('utf-8')
lex = shlex.shlex(s, posix=posix)
lex.whitespace_split = True
@@ -57,7 +57,7 @@ def split_commandstring(cmdstring):
and the like. This simply calls shlex.split but works also with unicode
bytestrings.
"""
- if isinstance(cmdstring, unicode):
+ if isinstance(cmdstring, str):
cmdstring = cmdstring.encode('utf-8', errors='ignore')
return shlex.split(cmdstring)
@@ -118,10 +118,10 @@ def string_decode(string, enc='ascii'):
if enc is None:
enc = 'ascii'
try:
- string = unicode(string, enc, errors='replace')
+ string = str(string, enc, errors='replace')
except LookupError: # malformed enc string
string = string.decode('ascii', errors='replace')
- except TypeError: # already unicode
+ except TypeError: # already str
pass
return string