diff options
-rw-r--r-- | scripts/genbopomofoheader.py | 8 | ||||
-rw-r--r-- | src/storage/pinyin_parser2.cpp | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/scripts/genbopomofoheader.py b/scripts/genbopomofoheader.py index 84d9999..9a204e4 100644 --- a/scripts/genbopomofoheader.py +++ b/scripts/genbopomofoheader.py @@ -66,6 +66,12 @@ bopomofo_keyboards = { } +def escape_char(ch): + if ch == "'" or ch == "\\": + ch = "\\" + ch; + return "'{0}'".format(ch) + + def gen_chewing_keyboard(scheme): keyboard = bopomofo_keyboards[scheme] items = [] @@ -74,7 +80,7 @@ def gen_chewing_keyboard(scheme): items = sorted(items, key=itemgetter(0)) entries = [] for (key, string) in items: - key = "'{0}'".format(key) + key = escape_char(key) string = '"{0}"'.format(string) entry = "{{{0: <5}, {1}}}".format(key, string) entries.append(entry) diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index ca04f8e..5524e69 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -30,6 +30,7 @@ #include "chewing_key.h" #include "pinyin_parser_table.h" #include "double_pinyin_table.h" +#include "chewing_table.h" using namespace pinyin; |