unicode cmdline / console IO support #22

Closed
rduplain opened this Issue Feb 29, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Collaborator

rduplain commented Feb 29, 2012

we are using flask-script in moin2 and recently found an issue when trying to give non-ascii user or page names via cmdline.

Even if Option(..., type=unicode, ...) it does not work because this just does unicode(s) and falls over everything the ascii decoder can't handle.

I tried to fix this, but later it seemed like opening a can of worms:

a) it seems to be not easy to find out the console encoding in a platform-independant reliable way

b) on windows (as usual), there seem to be more issues even requiring ctypes based workarounds (there was some discussion in the python bugtracker, but slow going - and it doesn't look like they want to fix it for python 2.x [and even if they'ld fix it now, it wouldn't be available for most existing python installations])

http://bugs.python.org/issue2128

The best place to fix this would be in argparse, but as that is part of Python stdlib now, the above issue applies. The separately available argparse seems stale.

I thought about fixing this in moin2, but it is the worst place. A little more useful (if not fixable in argparse) would be a fix in flask-script.

c) not cmdline, but closely related: after having solved a), supporting unicode input/output from console would also be a nice thing to have


Collaborator

rduplain commented Feb 29, 2012

(env)tw@x300:~/moin-2.0$ ./moin account_create --name HansMüller

./moin account_create: error: argument --name/-n: invalid unicode value: 'HansM\xc3\xbcller'

As you see, it can't decode it.


Original Comment By: Thomas Waldmann

Collaborator

rduplain commented Feb 29, 2012

What exact issue were you having ? Do you have a stacktrace ?


Original Comment By: Dan Jacob

techniq closed this May 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment