Author laurio
Recipients laurio
Date 2016-06-02.04:59:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Jython doesn't handle Unicode strings properly when using sun.locale.formatasdefault=true flag. 

- Window 7, OS language English and regional settings (including date formats) set to Finnish

Steps to reproduce:
- start Jython by "java -Dsun.locale.formatasdefault=true -jar jython-standalone-2.7.0.jar"
- enter to console:
-- from datetime import datetime
-- datetime.strptime('pe tammi 22 14:00:00 2016', u'%a %b %d %H:%M:%S %Y')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Z:\Lauri\jython-standalone-2.7.0.jar\Lib\", line 1778, in strptime
  File "Z:\Lauri\jython-standalone-2.7.0.jar\Lib\", line 308, in _strptime
  File "Z:\Lauri\jython-standalone-2.7.0.jar\Lib\", line 308, in _strptime
  File "Z:\Lauri\jython-standalone-2.7.0.jar\Lib\", line 265, in compile
  File "Z:\Lauri\jython-standalone-2.7.0.jar\Lib\", line 257, in pattern
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 18: ordinal not in range(128)

After removing the "u" from format-string this issue doesn't reproduce.

Originally happens when using RobotFramwork's DateTime-library and apparently there strings are using Unicode so using this without the "u" is not an option for me.

Related issue in RobotFramework that lead to the discovery that this is Jython bug:
Date User Action Args
2016-06-02 04:59:10lauriosetrecipients: + laurio
2016-06-02 04:59:10lauriosetmessageid: <>
2016-06-02 04:59:10lauriolinkissue2503 messages
2016-06-02 04:59:09lauriocreate