Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7241 closed defect (fixed)

Encoding problems when exporting wiki to console

Reported by: anonymous Owned by: Christian Boos
Priority: normal Milestone: 0.11.1
Component: admin/console Version: 0.11rc1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Found related tickets for 0.10.* versions but problem remains in 0.11rc1. Sorry if it is a duplicate…

When executing

trac-admin $trac_env wiki export $page_name

and the page contains Portuguese characters, like an "a with a tilde", I get the following error:

Traceback (most recent call last):
  File "C:\Program Files\Python25\Scripts\trac-admin-script.py", line 8, in <module>
    load_entry_point('Trac==0.11rc1', 'console_scripts', 'trac-admin')()
  File "c:\program files\python25\lib\site-packages\Trac-0.11rc1-py2.5-win32.egg
\trac\admin\console.py", line 1249, in run
    return admin.onecmd(command)
  File "c:\program files\python25\lib\site-packages\Trac-0.11rc1-py2.5-win32.egg
\trac\admin\console.py", line 104, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "C:\Program Files\Python25\Lib\cmd.py", line 219, in onecmd
    return func(arg)
  File "c:\program files\python25\lib\site-packages\Trac-0.11rc1-py2.5-win32.egg
\trac\admin\console.py", line 686, in do_wiki
    self._do_wiki_export(page, file)
  File "c:\program files\python25\lib\site-packages\Trac-0.11rc1-py2.5-win32.egg
\trac\admin\console.py", line 755, in _do_wiki_export
    print text
  File "C:\Program Files\Python25\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map) UnicodeEncodeError: 'charmap' codec can't encode character u'\xe3' in position 596: character maps to <undefined>

I'm running English version Windows XP SP3 with locale set to Portuguese.

Thanks, Antao

Attachments (2)

7241-trac-admin-wiki-export-r7376.diff (15.2 KB ) - added by Christian Boos 16 years ago.
Convert the print statements in admin/console.py to printout ones.
7241-trac-admin-wiki-export-r7376.2.diff (18.2 KB ) - added by Christian Boos 16 years ago.
Updated patch, also use printerr now

Download all attachments as: .zip

Change History (5)

comment:1 by Christian Boos, 16 years ago

Description: modified (diff)
Milestone: 0.11.1
Owner: changed from Christopher Lenz to Christian Boos

Reproduced, should be easy to fix now using console_print.

by Christian Boos, 16 years ago

Convert the print statements in admin/console.py to printout ones.

comment:2 by Christian Boos, 16 years ago

Status: newassigned

I changed mostly all the print statements for consistency and for catching potential similar issues. I also took this opportunity to add translation markers.

Follow-up patch will do the same for the older console_print(sys.stderr, ...) statements.

The changes are simples but there are many and I may have missed a thing or two, so review and testing appreciated!

by Christian Boos, 16 years ago

Updated patch, also use printerr now

comment:3 by Christian Boos, 16 years ago

Resolution: fixed
Status: assignedclosed

Patches applied in r7390 and r7391.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.