Message9432

Author pekka.klarck
Recipients amak, fwierzbicki, pekka.klarck, zyasoft
Date 2015-01-21.01:23:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1421803392.65.0.86523122175.issue1841@psf.upfronthosting.co.za>
In-reply-to
Content
1) I'm fine with getting and setting environment variables, cli arguments, etc. as Unicode on Jython. With Jython only code it would avoid the need to actually know the system encoding, and compatibility with CPython only requires one 'if' to decide is encoding/decoding needed.

2) Getting system encoding with Python is surprisingly complicated. With Robot Framework we get the encoding that is got first using these alternatives in this order:

- Any: sys.getfilesystemencoding()
- Jython: System.getProperty('file.encoding')
- POSIX: Environment variables LANG, LC_CTYPE, LANGUAGE, and LC_ALL
- Windows: ctypes.cdll.kernel32.GetACP()

Here's the code for anyone interested: https://github.com/robotframework/robotframework/blob/master/src/robot/utils/encodingsniffer.py

3) If there's a reliable way to get the correct encoding, I'd prefer sys.getfilesystemencoding() to return it.

4) The test that requires double decoding definitely looks wrong.
History
Date User Action Args
2015-01-21 01:23:12pekka.klarcksetmessageid: <1421803392.65.0.86523122175.issue1841@psf.upfronthosting.co.za>
2015-01-21 01:23:12pekka.klarcksetrecipients: + pekka.klarck, fwierzbicki, amak, zyasoft
2015-01-21 01:23:12pekka.klarcklinkissue1841 messages
2015-01-21 01:23:11pekka.klarckcreate