Edgewall Software

Changes between Initial Version and Version 1 of Ticket #6930


Ignore:
Timestamp:
Mar 4, 2008, 5:10:53 PM (14 years ago)
Author:
Tim Hatch
Comment:

First, make sure your $LANG is set correctly, and that Python is picking it up for stdout.

>>> import sys
>>> sys.stdout.encoding
'UTF-8'

Then, if you change the ''.join to u''.join, does it work correctly? I've never had to resort to codecs.getwriter just to print Unicode.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6930 – Description

    initial v1  
    11trac seems to be able to handle accented characters in state names or transition names. The showworkflow script, however, fails with the following exception when run on a .ini file that trac can handle:
    22
     3{{{
    34Traceback (most recent call last):
    45  File "./workflow_parser.py", line 109, in ?
     
    89UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 189: ordinal not in range(128)
    910Failed to parse "inventory-workflow.ini", exiting.
     11}}}
    1012
    1113The bug is actually in workflow_parser.py (and python's handling of sys.stdout): showworkflow runs workflow_parser.py and redirects the output. Because sys.stdout is redirected, its encoding is set to None, which means that ascii encoding is used. This can't handle most accented characters, result in the exception.