From 0f06266fd06ca468e4f7a484738b4b21a444d797 Mon Sep 17 00:00:00 2001 From: Zhorken Date: Fri, 24 Sep 2010 04:18:20 -0400 Subject: [PATCH] Fix handling of some fullwidth Latin characters in romanization. Including fullwidth 0, which was acutally a problem. --- pokedex/roomaji.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pokedex/roomaji.py b/pokedex/roomaji.py index 7740f0d..e91c960 100644 --- a/pokedex/roomaji.py +++ b/pokedex/roomaji.py @@ -86,11 +86,12 @@ def romanize(string): last_char = None # Used for small kana combos for char in string: # Full-width Latin - if ord(char) >= 0xff11 and ord(char) <= 0xff5e: + if 0xff01 <= ord(char) <= 0xff5e: if last_kana == 'sokuon': raise ValueError("Sokuon cannot precede Latin characters.") - char = chr(ord(char) - 0xff11 + 0x31) + # XXX Real Unicode decomposition would be nicer + char = chr(ord(char) - 0xff01 + 0x21) characters.append(char) last_kana = None -- 2.7.4