Hi Cheng,
I'm taking a look at this. When I implemented the unicode console
last year, I only did this for trunk (I'm not sure why...), so I
have to re-do it for rewrite, which has a slightly different user
interface code structure. I added some tests last weekend to make
sure I don't break anything and will try to get it done in the
coming weeks.
Best, Merlijn
On 5 June 2013 15:36, Cheng Yu Tin <justincheng12345(a)gmail.com>
wrote:
I try to use rewrite lately, but I encounter
something difficult
to reslove. -------- import pywikibot class TestBot: def
run(self): pywikibot.output(pywikibot.input('a')) def main(): bot
= TestBot() bot.run() if __name__ == "__main__": try: main()
finally: pass ---------- While test case is "pwb test" When I
type "字母频率", which "频" is not supported by cp950, it shows "
字母?
率" but "字母频率" is expected. In the same time, while using the same
script in Pywikipedia, it correctly shows "字母频率. Here is
something stranger, if "学校" is used, the following error is
given: D:\pywikipedia>pwb test a 学校 Traceback (most recent call
last): File "D:\pywikipedia\pwb.py", line 50, in <module>
execfile(sys.argv[0]) File "D:\pywikipedia\scripts\self\test.py",
line 21, in <module> main() File
"D:\pywikipedia\scripts\self\test.py", line 17, in main
bot.run() File "D:\pywikipedia\scripts\self\test.py", line 13, in
run pywikibot.output(pywikibot.input('a')) File
"D:\pywikipedia\pywikibot\bot.py", line 450, in input data =
ui.input(question, password) File
"D:\pywikipedia\pywikibot\userinterfaces\terminal_interface.py",
line 196, in input text = unicode(text, config.console_encoding)
UnicodeDecodeError: 'cp950' codec can't decode bytes in position
0-1: illegal multibyte sequence
When I try to do some tests myself, print(self.encoding) of
terminal_interface_base.py of pywikipedia gives utf-8, while
config.console_encoding of terminal_interface.py of rewrite gives
cp950.
Can somebody help?
_______________________________________________ Pywikipedia-l
mailing list Pywikipedia-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
_______________________________________________ Pywikipedia-l
mailing list Pywikipedia-l(a)lists.wikimedia.org