rduplain/flask-script — Issue #22: unicode cmdline / console IO support
Author: rduplain
Created: 2012-02-29 16:05:49+00:00
State: open
Labels: bug, import

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

---------------------------------------
- Bitbucket: https://bitbucket.org/danjac/flask-script/issue/22
- Originally Reported By: [Thomas Waldmann](http://bitbucket.org/thomaswaldmann)
- Originally Created At: 2011-02-22 11:19:30