Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 1.1.0.FINAL
    • Fix Version/s: 1.2.0.RC1, 1.1.1
    • Component/s: IoC
    • Labels:
      None

      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?

        Activity

        Hide
        Greg Turnquist added a comment -

        I have coded a batch of unit tests for both XMLConfig and YamlConfig. I then coded solutions so that it works for all sorts of situations. The only place you can't use unicode is in the names of attributes. Python code itself is limited to ASCII, and this is also tested and verified.

        Show
        Greg Turnquist added a comment - I have coded a batch of unit tests for both XMLConfig and YamlConfig. I then coded solutions so that it works for all sorts of situations. The only place you can't use unicode is in the names of attributes. Python code itself is limited to ASCII, and this is also tested and verified.

          People

          • Assignee:
            Greg Turnquist
            Reporter:
            Greg Turnquist
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: