Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3 Writer doesn't handle unicode type

closed-fixed
nobody
None
5
2005-08-10
2005-05-18
Kevin Whitefoot
No

The case construct in _write that decides what to do
depending on the type of the object fails if:

ty is types.UnicodeType

A solution is to add another clause:

elif ty is types.UnicodeType:
self._append('"')
self._append(obj)
self._append('"')

The body of the new clause is identical to that for type.
String. Not sure yet if anything else needs to be done
which is why I didn't combine them. This probably
converts the Unicode string to the default code page so it
might not be perfectly reversible. It works on my
machine (Python 2.4, WinXP SP1) and reads back
correctly (or at least good enough for my purposes).

Discussion

  • Logged In: NO

    I just changed line 285 to be

    elif ty is types.StringType or ty is types.UnicodeType:

    seemed to work ok.

     
    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=661556

    At least this much of the unicode problem is fixed.