Edgewall Software

Ticket #7217 (new defect)

Opened 8 months ago

Last modified 6 months ago

Non-ASCII characters get replaced with '?' in changeset metadata

Reported by: anonymous Owned by: cboos
Priority: normal Milestone: not applicable
Component: plugin/mercurial Version:
Severity: normal Keywords:
Cc:

Description

With TracMercurial, non-ASCII characters in changeset metadata strings get replaced with question marks. The plugin should set os.environ['HGENCODING'] = 'utf-8'.

I think in actuality this behavior can vary depending on the locale that Trac is running with, but I think it should just use UTF-8 regardless, since the plugin seems to expect that anyway (with calls to to_unicode(), which tries to decode from UTF-8 by default).

I'm not sure where exactly in the code it should set this, but this works for me, at least:

  • tracext/hg/backend.py

     
    2727                                    NoSuchChangeset, NoSuchNode 
    2828from trac.wiki import IWikiSyntaxProvider 
    2929 
     30os.environ['HGENCODING'] = 'utf-8' 
     31 
    3032try: 
    3133    # The new `demandimport` mechanism doesn't play well with code relying 
    3234    # on the `ImportError` exception being caught. 

Attachments

Change History

Changed 8 months ago by cboos

  • milestone set to not applicable

Changed 6 months ago by anonymous

I can second that, expecially when using mod_wsgi I got that problem. Using the fix described inside my trac.wsgi file eliminates the problem.

With standalone tracd that problem never arised.

I'm using hg (serv) too via mod_wsgi and there I didn't had to setup that variable. Might be something inside hg.

Add/Change #7217 (Non-ASCII characters get replaced with '?' in changeset metadata)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.