https://bugzilla.wikimedia.org/show_bug.cgi?id=55173
Web browser: --- Bug ID: 55173 Summary: Line ending inconsistency when using XmlReader Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1508/ Reported by: Anonymous user Created on: 2012-08-31 19:08:06 Subject: Line ending inconsistency when using XmlReader Original description: The following example explains it all:
import wikipedia p = wikipedia.Page(wikipedia.getSite(), "User:WGH") wikipedia.getall(wikipedia.getSite(), [p]) print "\r\n" in p.get() # True (using Special:Export and, in turn, xmlreader) print "\r\n" in p.get(force=True) # False (direct api)
It's caused by xmlreader replacing \n with \r\n for some reason. I suggest removing it altogether, because in Pyhon universal newlines are ususally used. Also \r\n line endings confuse mwlib parser. Patch: https://sourceforge.net/tracker/?func=detail&aid=3563805&group%5C_id...
% python version.py Pywikipedia trunk/pywikipedia/ (r10511, 2012/08/30, 20:40:38) Python 2.7.3 (default, Aug 31 2012, 16:05:44) [GCC 4.2.1 20070831 patched [FreeBSD]] config-settings: use_api = True use_api_login = True unicode test: ok