在使用 wx.TextCtrl 的文本编辑器中,字母键 (az) 数字键 (0-9) 映射到 unicode 值。
下面给出了遇到错误的行,
self.statusbar.SetStatusText(engine.roman2mal(self.word.decode('utf-8')),0)
错误消息如下所示,
Traceback (most recent call last):
File "F:\EZHUTHANI_WIN\ezhuthani\beditor.py", line 498, in PreviewConv
self.statusbar.SetStatusText(engine.roman2mal(self.word.decode('utf-8')),0)
File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)
有没有办法映射这些键(回车、空格键、退格)?其他键映射如下,
keymap = {}
keymap['a'] = u'\u0D05';
keymap['A'] = u'\u0D06';