Show More
@@ -187,14 +187,6 b' def arg_split(s, posix=False, strict=True):' | |||
|
187 | 187 | command-line args. |
|
188 | 188 | """ |
|
189 | 189 | |
|
190 | # Unfortunately, python's shlex module is buggy with unicode input: | |
|
191 | # http://bugs.python.org/issue1170 | |
|
192 | # At least encoding the input when it's unicode seems to help, but there | |
|
193 | # may be more problems lurking. Apparently this is fixed in python3. | |
|
194 | is_unicode = False | |
|
195 | if (not py3compat.PY3) and isinstance(s, unicode): | |
|
196 | is_unicode = True | |
|
197 | s = s.encode('utf-8') | |
|
198 | 190 | lex = shlex.shlex(s, posix=posix) |
|
199 | 191 | lex.whitespace_split = True |
|
200 | 192 | # Extract tokens, ensuring that things like leaving open quotes |
@@ -216,8 +208,5 b' def arg_split(s, posix=False, strict=True):' | |||
|
216 | 208 | # couldn't parse, get remaining blob as last token |
|
217 | 209 | tokens.append(lex.token) |
|
218 | 210 | break |
|
219 | ||
|
220 | if is_unicode: | |
|
221 | # Convert the tokens back to unicode. | |
|
222 | tokens = [x.decode('utf-8') for x in tokens] | |
|
211 | ||
|
223 | 212 | return tokens |
General Comments 0
You need to be logged in to leave comments.
Login now