Details
Description
Jedrek reported an issue with parsing an XML context file where it doesn't handle non-ascii values. This needs to be patched, especially considering the international support and visibility this project has.
================================
ello,
I'm trying to use the SpringPython 1.1 with a config file (utf-8 encoding) that contains non-ascii characters, for example:
<property name="someProperty">
<list>
<value>العربية</value>
</list>
</property>
I use the SpringPython in the following way:
applicationConfig = ApplicationConfig(XMLConfig("conf.xml"))
It fails with UnicodeEncodeError 'ascii codec can't encodee characters ... at line 707 in springpython.config
the fragment causing problems is str(p.get("value")) - in case p.get("value") returns unicode, it fails. The same problem is in multiple places.
Invoking just unicode(text) would not help - the default encoding (which often is ASCII) cannot handle the non-ascii characters (in my case one would need to do unicode(text, "utf-8")
I've noticed this problem when launching my script from the windows commandline (which sets, in my case, the default encoding to cp1250). It works fine from eclipse (which sets the default encoding to utf-8).
Am I doing something wrong / is there a possibility to supply the encoding that will be used?