Feature Requests item #3602107, was opened at 2013-01-25 06:38 Message generated for change (Comment added) made by xqt You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603141&aid=3602107...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None
Priority: 3
Private: No Submitted By: Анима (n-fran) Assigned to: Nobody/Anonymous (nobody) Summary: standardize_notes.py encoding
Initial Comment: If I want to add to the script text of russian letters, is this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
To avoid this error, I think, it is necessary to register in the code bot these or any of the other lines:
# -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8')
And my bot started to function. Thanks.
----------------------------------------------------------------------
Comment By: xqt (xqt)
Date: 2013-01-26 11:18
Message: While using python 2.X there are two kind of stings: ASCII strings are noted like "This is a ascii string" unicode strings are noted like u"This is a unicode string"
Just write a u before that sting in line 987 (and remove that reload/encoding stuff): new_text = new_text + u'\n== Notes ==\n' # set to standard name
But ok, this part should be localized
----------------------------------------------------------------------
Comment By: Анима (n-fran) Date: 2013-01-25 09:32
Message: In my user-config.py there are lines
console_encoding = 'cp1251' transliteration_target = console_encoding
but the problems with the coding still a lot. Thank you.
----------------------------------------------------------------------
Comment By: Анима (n-fran) Date: 2013-01-25 09:23
Message: Sorry, my knowledge of the English language, particularly on the part of the technical terms, it may be bad. I meant that I was putting in Russian characters in the file standardize_notes.py . For example, I changed the '\n== Notes ==\n' to '\n== Примечания ==\n' (line 987), and then this error appeared:
When I added in the beginning of the text file, which is pointed out above, the problem disappeared. Thank you.
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2013-01-25 07:38
Message: I cannot follow what you mean with "add to the script". Do you want to modify the script or enter russian characters on the command line?
What is the complete error you got.
Did you set your transliteration_target and console_encoding in your user-config.py
reload(sys) after import sys does not matter since it just reloads the same module
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603141&aid=3602107...
pywikipedia-bugs@lists.wikimedia.org