Show More
@@ -187,14 +187,6 b' def arg_split(s, posix=False, strict=True):' | |||||
187 | command-line args. |
|
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 | lex = shlex.shlex(s, posix=posix) |
|
190 | lex = shlex.shlex(s, posix=posix) | |
199 | lex.whitespace_split = True |
|
191 | lex.whitespace_split = True | |
200 | # Extract tokens, ensuring that things like leaving open quotes |
|
192 | # Extract tokens, ensuring that things like leaving open quotes | |
@@ -216,8 +208,5 b' def arg_split(s, posix=False, strict=True):' | |||||
216 | # couldn't parse, get remaining blob as last token |
|
208 | # couldn't parse, get remaining blob as last token | |
217 | tokens.append(lex.token) |
|
209 | tokens.append(lex.token) | |
218 | break |
|
210 | break | |
219 |
|
211 | |||
220 | if is_unicode: |
|
|||
221 | # Convert the tokens back to unicode. |
|
|||
222 | tokens = [x.decode('utf-8') for x in tokens] |
|
|||
223 | return tokens |
|
212 | return tokens |
General Comments 0
You need to be logged in to leave comments.
Login now