This commit is contained in:
Tan, Kian-ting 2016-04-06 20:09:56 +08:00
parent af86822479
commit 8b4c9c10a8

View file

@ -1,3 +1,4 @@
#!/usr/bin/env python3
#-*-coding:utf-8-*-
import sqlite3
@ -121,10 +122,10 @@ class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow):
def input_characters(self):
import re
characters = self.lineEdit.text()
chinese_char_pattern = re.compile(u"^([一-鿌㐀-䶵\U00020000-\U0002A6D6])+$",re.UNICODE)
chinese_char_pattern = re.compile(u"^((?<cjk>[一-鿌㐀-䶵𠀀-𪛖𪜀-𫜴𫝀-𫠝𫠠-𬺡])|[^\CJK\s\t\n]+)+$",re.UNICODE)
is_chinese_chars = chinese_char_pattern.match(characters)
if is_chinese_chars:
if 1:
char_code_list = [(ch,find_code(ch,self.c)) for ch in characters]
self.show_result(char_code_list)
else:
@ -143,3 +144,5 @@ if __name__ == '__main__':