Message5671

Author pekka.klarck
Recipients pekka.klarck
Date 2010-04-11.21:58:45
SpamBayes Score 4.55716e-06
Marked as misclassified No
Message-id <1271023126.16.0.15113620202.issue1592@psf.upfronthosting.co.za>
In-reply-to
Content
I think I found a workaround for this problem, or at least the following code prints the same correct results both on CPython 2.6 and Jython 2.5.1 on Ubuntu. Does anyone see problems in it or have some cleaner solution?


import sys

if sys.platform.startswith('java'):
    def _to_unicode(arg):
        return ''.join(unichr(ord(c)) for c in arg)
else:
    def _to_unicode(arg):
        return unicode(arg, sys.getfilesystemencoding())

args = [ _to_unicode(a) for a in sys.argv[1:] ]
for a in args:
    print a
History
Date User Action Args
2010-04-11 21:58:46pekka.klarcksetmessageid: <1271023126.16.0.15113620202.issue1592@psf.upfronthosting.co.za>
2010-04-11 21:58:46pekka.klarcksetrecipients: + pekka.klarck
2010-04-11 21:58:46pekka.klarcklinkissue1592 messages
2010-04-11 21:58:45pekka.klarckcreate