hi Jeff,
I haven't learned enough about the Java Hashmap yet. I ended up coding a workaround that worked. but, really, it was for my own use, to ensure the months displayed properly in other languages.
I appreciate the reply.
Regards,
Jeff Allen <ja.py@farowl.co.uk> added the comment: Thanks for bringing this up. This isn't really to do with calendars. gc.getDisplayName(2,2,loc) returns a java.util.HashMap and our __repr__ for that is trying to force the Unicode it contains into byte-strings. Simpler demonstration:from java.util import GregorianCalendar from java.util import Locale gc = GregorianCalendar() names = gc.getDisplayNames(2, 2, Locale.KOREAN) dict(names){u'4\uc6d4': 3, u'3\uc6d4': 2, u'2\uc6d4': 1, u'1\uc6d4': 0, u'12\uc6d4': 11, u'10\uc6d4': 9, u'11\uc6d4': 10, u'9\uc6d4': 8, u'8\uc6d4': 7, u'7\uc6d4': 6, u'6\uc6d4': 5, u'5\uc6d4': 4} But look at names with print or in the REPL and it blows up.namesTraceback (most recent call last): File "<stdin>", line 1, in <module> java.lang.IllegalArgumentException: Cannot create PyString with non-byte value at org.python.core.PyString.<init>(PyString.java:57) at org.python.core.PyString.<init>(PyString.java:70) at org.python.core.PyString.<init>(PyString.java:74) at org.python.core.JavaProxyMap$2.__call__(JavaProxyMap.java:115) at org.python.core.PyObjectDerived.__repr__(PyObjectDerived.java:104) ... ---------- nosy: +jeff.allen priority: -> normal resolution: -> accepted severity: minor -> normal title: GregorianCalendar.getDisplayNames() crashes with PyString error -> __repr__ of Java Map having unicode keys crashes with PyString error _______________________________________ Jython tracker <report@bugs.jython.org> <http://bugs.jython.org/issue2649> _______________________________________