Last modified: 2013-10-10 18:36:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57210, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55210 - new lines not managed correctly
new lines not managed correctly
Status: RESOLVED WORKSFORME
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:44 UTC by Kunal Mehta (Legoktm)
Modified: 2013-10-10 18:36 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:44:09 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1415/
Reported by: paolobenve
Created on: 2012-03-03 12:53:35
Subject: new lines not managed correctly
Original description:
$ python version.py
Pywikipedia \[http\] trunk/pywikipedia \(r9946, 2012/03/01, 09:52:33\)
Python 2.6.6 \(r266:84292, Dec 26 2010, 22:31:48\) 
\[GCC 4.4.5\]
config-settings:
use\_api = True
use\_api\_login = True
unicode test: triggers problem \#3081100

Linux debian

I'm using the bot on the server itself where mediawiki is installed.

If I insert a new line with the replace.py script \(e.g., with the replace string like "asdf\n"\), a subsequent regex search of the same string \(e.g, "asdf\n"\) won't match, while "asdf\r\n" will match.

It seems that when the bot must insert \n, actualy it inserts \r\n.
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:44:11 UTC
maybe it's mediawiki who inserts. Just use "asdf\r?\n" for the regex
Comment 2 Maarten Dammers 2013-10-10 18:36:13 UTC
If you want to insert new lines you can use "\n" or "\r\n", if you want to look for end of lines you have to use "\r\n". This is just the way MediaWiki works.

See also http://programmers.stackexchange.com/questions/29075/difference-between-n-and-r-n for reference.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links