I developed mwhair for the runescape wiki. I keep running into a problem with unicode though, whenever I have, let’s say a page that looks like this:
This is a page, that has words
To go here to there follow these directions:
Backwards « Forwards
That is all
If simply do mwhair.edit('Page above'), I’ll be given a unicode error.
I tried resolving this by doing:
text = mwhair.edit('Page above').encode('ascii','xmlcharrefreplace')
mwhair.save('Page above',text=text)
This seemed like a solution as no error would come up, but it’d change some contents of the page, such as changing the line to:
Backwards « Forwards
This didn’t effect any links, pictures, or the actual page output but made bot seem as if it had errors. Is there something I’m messing up or don’t know? (I’m using python 2.7.3)
On line 230 you have this:
textis Unicode at that point, so you probably want to encode it at that point.I assume MediaWiki wants UTF-8: