Modify

Opened 16 years ago

Closed 16 years ago

#3136 closed defect (fixed)

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Reported by: anonymous Owned by: Radek Bartoň
Priority: normal Component: ScreenshotsPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

How to Reproduce

While doing a GET operation on /screenshots, Trac issued an internal error.

(please provide additional details here)

User Agent was: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.8.1.14) Gecko/20080404 Iceweasel/2.0.0.14 (Debian-2.0.0.14-2)

System Information

Trac 0.11dev-r7184
Python 2.5.2 (r252:60911, May 15 2008, 17:59:19)
[GCC 4.3.1 20080501 (prerelease)]
setuptools 0.6c8
SQLite 3.5.9
pysqlite 2.4.1
Genshi 0.4.4
Pygments 0.10
Subversion 1.4.6 (r28521)
jQuery: 1.2.3

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r7184-py2.5.egg/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r7184-py2.5.egg/trac/web/main.py", line 219, in dispatch
    data, content_type)
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r7184-py2.5.egg/trac/web/chrome.py", line 723, in render_template
    return stream.render(method, doctype=doctype)
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/core.py", line 154, in render
    return encode(generator, method=method, encoding=encoding)
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/output.py", line 45, in encode
    output = u''.join(list(iterator))
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/output.py", line 274, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/output.py", line 519, in __call__
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/output.py", line 679, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/output.py", line 459, in __call__
    for ev in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/core.py", line 212, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/core.py", line 212, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r7184-py2.5.egg/trac/web/chrome.py", line 779, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/core.py", line 212, in _ensure
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Trac-0.11dev_r7184-py2.5.egg/trac/web/chrome.py", line 768, in _generate
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/markup.py", line 252, in _include
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/markup.py", line 322, in _match
    content = list(self._include(content, ctxt))
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/markup.py", line 252, in _include
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/markup.py", line 297, in _match
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/markup.py", line 286, in _strip
    event = stream.next()
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/markup.py", line 242, in _exec
    for event in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/base.py", line 398, in _eval
    for kind, data, pos in stream:
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/base.py", line 448, in _flatten
    for event in self._flatten(substream, ctxt):
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/base.py", line 448, in _flatten
    for event in self._flatten(substream, ctxt):
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/base.py", line 447, in _flatten
    substream = _apply_directives(substream, ctxt, directives)
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/base.py", line 256, in _apply_directives
    stream = directives[0](iter(stream), ctxt, directives[1:])
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/directives.py", line 604, in __call__
    matched = bool(self.expr.evaluate(ctxt))
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/eval.py", line 136, in evaluate
    return eval(self.code, _globals, {'data': data})
  File "/var/www/.python-eggs/TracScreenshots-0.6-py2.5.egg-tmp/tracscreenshots/templates/screenshots.html", line 56, in <Expression u'screenshots.enabled_components[component.name]'>
    <input py:when="screenshots.enabled_components[component.name]" type="checkbox" name="components" value="${component.name}" checked="yes">
  File "/usr/lib/python2.5/site-packages/Genshi-0.4.4-py2.5.egg/genshi/template/eval.py", line 284, in lookup_item
    val = getattr(obj, key, UNDEFINED)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Attachments (0)

Change History (7)

comment:1 Changed 16 years ago by Radek Bartoň

Status: newassigned

It seems you have international or other non-ascii character in some component name? Which one is it please?

comment:2 Changed 16 years ago by raa

Yes, I have two components, and both are named in Russian. But I did not expect this can couse a problem. Why does this error happens? And how to fix it?

Thanks

comment:3 Changed 16 years ago by raa

Excuse me please for my English :-)

Could you please explain? Do you mean a component as a ticket property or as some trac plugin?

I mean I have to predefined values for the component field of the tickets, but I do not have any non-ascii characters in file names and so on.

comment:4 Changed 16 years ago by raa

_tWo_ predefined values (to => two). With russian characters. Sorry again :-)

comment:5 Changed 16 years ago by Radek Bartoň

Yes, I mean the component as a ticket property. The reason is that there is no ID of component in database schema and they are identified by their name. This name is given to <input value="<component_name>"/> tag and that causes the problem. I'll search how is this solved in Trac internals or I'll introduce iteration over registered components to get their virtual ID and use it. But you must wait until I'll have more time for this.

comment:6 Changed 16 years ago by raa

ok, I will wait. Thank you very much!

comment:7 Changed 16 years ago by Radek Bartoň

Resolution: fixed
Status: assignedclosed

Actually this is not problem in the plugin but the Genshi but I've added workaround for this in r4278 until it will be fixed.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.