diff --git a/gramps/cli/arghandler.py b/gramps/cli/arghandler.py index fa81a0153..b82cc6204 100644 --- a/gramps/cli/arghandler.py +++ b/gramps/cli/arghandler.py @@ -51,7 +51,6 @@ from gramps.gen.plug.report import CATEGORY_BOOK, CATEGORY_CODE, BookList from .plug import cl_report, cl_book from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gramps.gen.constfunc import conv_to_unicode from gramps.gen.config import config #------------------------------------------------------------------------- @@ -213,7 +212,6 @@ class ArgHandler(object): """ if value is None: return None - value = conv_to_unicode(value, sys.stdin.encoding) db_path = self.__deduce_db_path(value) if db_path: @@ -242,9 +240,7 @@ class ArgHandler(object): Handle the "-i" or "--import" option. Only Files supported by a plugin can be imported, so not Family Trees. """ - # Need to convert path/filename to unicode before opening - # For non latin characters in Windows path/file/user names - fname = conv_to_unicode(value, sys.stdin.encoding) + fname = value fullpath = os.path.abspath(os.path.expanduser(fname)) if fname != '-' and not os.path.exists(fullpath): self.__error(_('Error: Import file %s not found.') % fname) @@ -279,9 +275,7 @@ class ArgHandler(object): """ if self.gui: return - # Need to convert path/filename to unicode before opening - # For non latin characters in Windows path/file/user names - fname = conv_to_unicode(value, sys.stdin.encoding) + fname = value if fname == '-': fullpath = '-' else: diff --git a/gramps/cli/argparser.py b/gramps/cli/argparser.py index e503c70df..b06d22045 100644 --- a/gramps/cli/argparser.py +++ b/gramps/cli/argparser.py @@ -48,7 +48,6 @@ from gramps.gen.config import config from gramps.gen.utils.cast import get_type_converter from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gramps.gen.constfunc import conv_to_unicode _HELP = _(""" Usage: gramps.py [OPTION...] @@ -220,14 +219,6 @@ class ArgParser(object): Any errors are added to self.errors """ try: - # Convert arguments to unicode, otherwise getopt will not work - # if a non latin character is used as an option (by mistake). - # getopt will try to treat the first char in an utf-8 sequence. Example: - # -Ärik is '-\xc3\x84rik' and getopt will respond : - # option -\xc3 not recognized - for arg in range(len(self.args) - 1): - self.args[arg+1] = conv_to_unicode(self.args[arg + 1], - sys.stdin.encoding) options, leftargs = getopt.getopt(self.args[1:], SHORTOPTS, LONGOPTS) except getopt.GetoptError as msg: @@ -377,8 +368,7 @@ class ArgParser(object): # but not for non-latin characters in list elements cliargs = "[ " for arg in range(len(self.args) - 1): - cliargs += conv_to_unicode(self.args[arg + 1], - sys.stdin.encoding) + ' ' + cliargs += self.args[arg + 1] + ' ' cliargs += "]" self.errors += [(_('Error parsing the arguments'), _("Error parsing the arguments: %s \n" diff --git a/gramps/cli/clidbman.py b/gramps/cli/clidbman.py index 0803d7307..aee331a00 100644 --- a/gramps/cli/clidbman.py +++ b/gramps/cli/clidbman.py @@ -55,7 +55,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gramps.gen.plug import BasePluginManager from gramps.gen.config import config -from gramps.gen.constfunc import win, conv_to_unicode +from gramps.gen.constfunc import win #------------------------------------------------------------------------- # # constants @@ -369,8 +369,6 @@ class CLIDbManager(object): Returns old_name, new_name if success, None, None if no success """ try: - filepath = conv_to_unicode(filepath, 'utf8') - new_text = conv_to_unicode(new_text, 'utf8') name_file = open(filepath, "r", encoding='utf8') old_text=name_file.read() name_file.close() @@ -427,7 +425,7 @@ def find_next_db_name(name_list): while True: title = "%s %d" % (DEFAULT_TITLE, i) if title not in name_list: - return conv_to_unicode(title) + return title i += 1 def find_next_db_dir():