From 1e75d6f8541ab0cd8922ee1ecd6756d4a103a9e5 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 3 Sep 2014 17:21:43 +0200 Subject: [PATCH] add japanese, fix utf8 --- lib/commands.py | 2 +- lib/mnemonic.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/commands.py b/lib/commands.py index 731d40d39..a2bfc9d41 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -134,7 +134,7 @@ class Commands: def make_seed(self, nbits, custom_entropy, language): from mnemonic import Mnemonic s = Mnemonic(language).make_seed(nbits, custom_entropy) - return s + return s.encode('utf8') def check_seed(self, seed, custom_entropy, language): from mnemonic import Mnemonic diff --git a/lib/mnemonic.py b/lib/mnemonic.py index aa0a78fed..9ca8d5d7f 100644 --- a/lib/mnemonic.py +++ b/lib/mnemonic.py @@ -37,6 +37,8 @@ class Mnemonic(object): filename = 'english.txt' elif lang[0:2] == 'pt': filename = 'portuguese.txt' + elif lang[0:2] == 'ja': + filename = 'japanese.txt' else: filename = 'english.txt' @@ -48,7 +50,7 @@ class Mnemonic(object): line = line.strip(' \r') assert ' ' not in line if line: - self.wordlist.append(line) + self.wordlist.append(line.decode('utf8')) print_error("wordlist has %d words"%len(self.wordlist)) @classmethod