Page MenuHomePhabricator

Support for unicode text input in cmd on windows
Closed, ResolvedPublic

Description

System Environment:
Windows 7 X64 SP1
CLI: cmd.exe

As of now, the Core branch of the framework doesn't seem to support direct unicode input in the CLI.

The command:

python pwb.py C:/Users/username/core/scripts/add_text.py -page:%E0%A4%B8%E0%A4%A6%E0%A4%B8%E0%A5%8D%E0%A4%AF:Siddhartha_Ghai/sandbox17 -text:"जाँच" -summary:"जाँच"

gave this diff:
https://hi.wikipedia.org/w/index.php?title=%E0%A4%B8%E0%A4%A6%E0%A4%B8%E0%A5%8D%E0%A4%AF%3ASiddhartha_Ghai%2Fsandbox17&diff=2214593&oldid=2214592

The devanagari input text and the editsummary both are lost as question marks.


Version: core-(2.0)
Severity: normal
Platform: PC

Details

Reference
bz54726

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:23 AM
bzimport set Reference to bz54726.

Note to myself: support is there, but it's not implemented into handleArgs (and pwb.py might also need some adaptation)

null.py is an empty file...

...n\pwb>python -i pwb.py null.py के अवतरणों में अंतर

import pywikibot
pywikibot.handleArgs()

[u'null.py', u'??', u'???????', u'???', u'????']

from pywikibot.userinterfaces.win32_unicode import argv
argv

['pwb.py', 'null.py', '\xe0\xa4\x95\xe0\xa5\x87', '\xe0\xa4\x85\xe0\xa4\xb5\xe0\xa4\xa4\xe0\xa4\xb0\xe0\xa4\xa3\xe0\xa5\x8b\xe0\xa4\x82', '\xe0\xa4\xae\xe0\xa5\x87\xe0\xa4\x82', '\xe0\xa4\x85\xe0\xa4\x82\xe0\xa4\xa4\xe0\xa4\xb0']

[x.decode('utf-8') for x in argv]

[u'pwb.py', u'null.py', u'\u0915\u0947', u'\u0905\u0935\u0924\u0930\u0923\u094b\u0902', u'\u092e\u0947\u0902', u'\u0905\u0902\u0924\u0930']

pywikibot.output(u' '.join(x.decode('utf-8') for x in argv))

pwb.py null.py के अवतरणों में अंतर

Change 86386 had a related patch set uploaded by Merlijn van Deen:
Bug 54726 - Add Windows unicode cmd argument support

https://gerrit.wikimedia.org/r/86386

Siddhartha, if you feel comfortable enough with git, please fetch the last patchset of https://gerrit.wikimedia.org/r/#/c/86386/ and test if it works for you.

using command-line git, this is the command:

git fetch https://gerrit.wikimedia.org/r/pywikibot/core refs/changes/86/86386/5 && git checkout FETCH_HEAD

Change 86386 merged by jenkins-bot:
Bug 54726 - Add Windows unicode cmd argument support

https://gerrit.wikimedia.org/r/86386