Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#11388 closed defect (fixed)

TypeError: decoding Unicode is not supported

Reported by: matheusslima@… Owned by: Jun Omae
Priority: normal Component: TracForgePlugin
Severity: normal Keywords:
Cc: Trac Release:


How to Reproduce

While doing a GET operation on /projects/analistas/browser/Baselines, Trac issued an internal error.

I'm trying to migrate some TRAC projects from a old 0.12dev-r7634 to a new 0.12.5 installation

Request parameters:


User agent: `Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0`

System Information

TRAC 0.12.5

Enabled Plugins


Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 522, in
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 199, in
    if handler.match_request(req):
  File "/usr/local/lib/python2.7/dist-
packages/TracForge-1.1-py2.7.egg/tracforge/admin/", line 117,
in match_request
    self._send_project(req, path_info)
  File "/usr/local/lib/python2.7/dist-
packages/TracForge-1.1-py2.7.egg/tracforge/admin/", line 196,
in _send_project
    req._response = dispatch_request(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 490, in
    return _dispatch_request(req, env, env_error)
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 566, in
    send_internal_error(env, req, sys.exc_info())
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 645, in
    description_en = get_description(lambda s, **kw: safefmt(s, kw))
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 640, in
    method=req.method, path_info=req.path_info,
  File "/usr/lib/python2.7/dist-packages/trac/web/", line 250, in
    return unicode(path_info, 'utf-8')
TypeError: decoding Unicode is not supported

Attachments (0)

Change History (6)

comment:1 Changed 4 years ago by anonymous

comment:3 Changed 4 years ago by matheusslima@…

i have made the following changes on "/usr/lib/python2.7/dist-packages/trac/web/" and now works:

    def path_info(self):
        """Path inside the application"""
        path_info = self.environ.get('PATH_INFO', '')
            return unicode(path_info, 'utf-8')
#        except UnicodeDecodeError:
#            raise HTTPNotFound(_("Invalid URL encoding (was %(path_info)r)",
#                                 path_info=path_info))
        except (TypeError, UnicodeDecodeError):
                return path_info


comment:4 Changed 4 years ago by Jun Omae

No, that is a TracForgePlugin issue, not a Trac issue.

The issue is probably caused by changing environ['PATH_INFO'] to unicode instance.

  • branches/bewst/0.11-clearsilver/tracforge/admin/

    164164                return self.start_response(*args)
    166166        environ['SCRIPT_NAME'] = req.href.projects('/')
    167         environ['PATH_INFO'] = path_info
     167        environ['PATH_INFO'] = path_info.encode('utf-8')
    168168        environ['trac.env_parent_dir'] = os.path.dirname(self.env.path)
    169169        if 'TRAC_ENV' in environ:
    170170            del environ['TRAC_ENV']

comment:5 Changed 3 years ago by Ryan J Ollos

Owner: Noah Kantrowitz deleted

comment:6 Changed 2 years ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Resolution: fixed
Status: newclosed

In 15303:

Encode path_info as utf-8

Patch by jun66j5. Fixes #11388.

comment:7 Changed 2 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jun Omae.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.