summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2010-11-23 18:33:58 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2010-11-23 18:33:58 +0900
commitef1a6edef6bd269677b57aa243dd6dd2e9a221a9 (patch)
tree5f7465a15ce4c8baf6363a1bfad6b3bfbeafe527
parentf8f201c12fbd2af2154e13d5d46bff67f714179d (diff)
downloadibus-anthy-ef1a6edef6bd269677b57aa243dd6dd2e9a221a9.tar.gz
Fixed romaji_typing_rule and kana_typing_rule receives UTF-8 keys. (#1146)
-rw-r--r--engine/kana.py8
-rw-r--r--engine/romaji.py8
2 files changed, 16 insertions, 0 deletions
diff --git a/engine/kana.py b/engine/kana.py
index d98852e..a2be52b 100644
--- a/engine/kana.py
+++ b/engine/kana.py
@@ -23,6 +23,7 @@
from ibus import unichar_half_to_full
from tables import *
import segment
+import sys
_UNFINISHED_HIRAGANA = set(u"かきくけこさしすせそたちつてとはひふへほ")
@@ -53,6 +54,13 @@ class KanaSegment(segment.Segment):
value = None
section = self._kana_typing_rule_section
if section != None:
+ try:
+ # U+A5 needs to be UTF-8 since gconf values are
+ # disk saved values.
+ enchars = enchars.encode('utf-8')
+ except:
+ print >> sys.stderr, \
+ "Failed to encode UTF-8:", enchars
if enchars in prefs.keys(section):
value = unicode(str(prefs.get_value(section, enchars)))
else:
diff --git a/engine/romaji.py b/engine/romaji.py
index 3f28ff6..3e656fc 100644
--- a/engine/romaji.py
+++ b/engine/romaji.py
@@ -23,6 +23,7 @@
from ibus import unichar_half_to_full
from tables import *
import segment
+import sys
def romaji_correction_rule_get(k, d):
return (u'ん', k[1:2]) if k[0:1] == u'n' and not k[1:2] in u"aiueony'" else d
@@ -56,6 +57,13 @@ class RomajiSegment(segment.Segment):
value = None
section = self._romaji_typing_rule_section
if section != None:
+ try:
+ # U+A5 needs to be UTF-8 since gconf values are
+ # disk saved values.
+ enchars = enchars.encode('utf-8')
+ except:
+ print >> sys.stderr, \
+ "Failed to encode UTF-8:", enchars
if enchars in prefs.keys(section):
value = unicode(str(prefs.get_value(section, enchars)))
else: