From 4ae32cf4ee8cc69d73930f4565c55097cb1f5ce2 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Wed, 23 Nov 2016 08:12:01 -0500 Subject: [PATCH] bash: use generic shell's UTF-8 methods --- thefuck/shells/bash.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/thefuck/shells/bash.py b/thefuck/shells/bash.py index 1d8ab7db..f914163f 100644 --- a/thefuck/shells/bash.py +++ b/thefuck/shells/bash.py @@ -1,6 +1,5 @@ import os import bashlex -import six from ..conf import settings from ..utils import memoize from .generic import Generic @@ -49,17 +48,11 @@ class Bash(Generic): return 'eval $(thefuck --alias)', config def split_command(self, command): - if six.PY2: - command = command.encode('utf8') + generic = Generic() # If bashlex fails for some reason, fallback to shlex # See https://github.com/idank/bashlex#limitations try: - command_parts = list(bashlex.split(command)) + return generic.decode_utf8(list(bashlex.split(generic.encode_utf8(command)))) except: - return Generic().split_command(command) - - if six.PY2: - return [s.decode('utf8') for s in command_parts] - else: - return command_parts + return generic.split_command(command)