More effort put into this problem yielded a likely solution (i.e. 'hack'). First of all, the Python Exception was
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
This was with the bogus Simplified Chinese command 我。The expected way command-not-found should have handled this would be something like:
root@u-VirtualBox:~# mgcc 未找到 'mgcc' 命令,您要输入的是否是: 命令 'mlcc' 来自于包 'mlterm-tools' (universe) 命令 'cgcc' 来自于包 'sparse' (multiverse) 命令 'gcc' 来自于包 'gcc' (main) 命令 'gcc' 来自于包 'pentium-builder' (universe) mgcc:找不到命令
Now the hack involves updating two Python files in the package:
(1) /usr/lib/command-not-found (line 24) : cnf.install(unicode=True) ==> cnf.install(unicode=False)
(2) /usr/share/pyshared/CommandNotFound/util.py (line 9): _ = gettext.translation("command-not-found", fallback=True).ugettext ==> _ = gettext.translation("command-not-found", fallback=True).lgettext
With these edits in place, command-not-found can now handle the test case:
root@u-VirtualBox:~# 我 我:找不到命令
More effort put into this problem yielded a likely solution (i.e. 'hack'). First of all, the Python Exception was
UnicodeDec odeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
This was with the bogus Simplified Chinese command 我。The expected way command-not-found should have handled this would be something like:
root@u- VirtualBox: ~# mgcc
未找到 'mgcc' 命令,您要输入的是否是:
命令 'mlcc' 来自于包 'mlterm-tools' (universe)
命令 'cgcc' 来自于包 'sparse' (multiverse)
命令 'gcc' 来自于包 'gcc' (main)
命令 'gcc' 来自于包 'pentium-builder' (universe)
mgcc:找不到命令
Now the hack involves updating two Python files in the package:
(1) /usr/lib/ command- not-found (line 24) : install( unicode= True) ==> cnf.install( unicode= False)
cnf.
(2) /usr/share/ pyshared/ CommandNotFound /util.py (line 9): translation( "command- not-found" , fallback= True).ugettext ==> translation( "command- not-found" , fallback= True).lgettext
_ = gettext.
_ = gettext.
With these edits in place, command-not-found can now handle the test case:
root@u- VirtualBox: ~# 我
我:找不到命令
root@u- VirtualBox: ~# mgcc
未找到 'mgcc' 命令,您要输入的是否是:
命令 'mlcc' 来自于包 'mlterm-tools' (universe)
命令 'cgcc' 来自于包 'sparse' (multiverse)
命令 'gcc' 来自于包 'gcc' (main)
命令 'gcc' 来自于包 'pentium-builder' (universe)
mgcc:找不到命令