Edgewall Software

Ticket #7241 (closed defect: fixed)

Opened 5 months ago

Last modified 2 months ago

Encoding problems when exporting wiki to console

Reported by: anonymous Owned by: cboos
Priority: normal Milestone: 0.11.1
Component: admin/console Version: 0.11rc1
Severity: normal Keywords:
Cc:

Description (last modified by cboos) (diff)

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

7241-trac-admin-wiki-export-r7376.diff (15.2 kB) - added by cboos 3 months 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 cboos 3 months ago.
Updated patch, also use printerr now

Change History

Changed 3 months ago by cboos

  • owner changed from cmlenz to cboos
  • description modified (diff)
  • milestone set to 0.11.1

Reproduced, should be easy to fix now using console_print.

Changed 3 months ago by cboos

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

Changed 3 months ago by cboos

  • status changed from new to assigned

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!

Changed 3 months ago by cboos

Updated patch, also use printerr now

Changed 2 months ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Patches applied in r7390 and r7391.

Add/Change #7241 (Encoding problems when exporting wiki to console)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.