Last modified: 2014-07-30 16:11:45 UTC
sample: >>> import pwb >>> import pywikibot as py >>> s = py.Site('af') >>> p = py.Page(s, 'user:xqt') >>> p Page(Gebruiker:Xqt) >>> s = py.Site('fa') >>> p = py.Page(s, 'user:xqt') >>> p Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> p File "pywikibot\page.py", line 224, in __repr__ self.title().encode(config.console_encoding)) File "C:\Python27\lib\encodings\cp850.py", line 12, in encode return codecs.charmap_encode(input,errors,encoding_map) UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-4: character maps to <undefined>
Taking as I've been working on this for a while due to the cache key bug.
We now have a test case for this in page_tests, which fails after a clean install of pywikibot. One way to workaround this problem is to set the console codepage to 65001x C:\pywikibot\core>chcp 65001 Active code page: 65001 And set pywikibot console_encoding = 'utf-8' One my console, ar and fa doesnt display properly - boxes are used - but copying the console text does put the proper ar/fa text into the clipboard buffer. However in pwb shell, 'print p' causes another exception. >>> pywikibot.output(p) Page(کاربر:John Vandenberg) >>> p Page(کاربر:John Vandenberg)Traceback (most recent call last): File "<console>", line 1, in <module> IOError: [Errno 0] Error