BUG: TG.1.05 and unicode url's?

4 views
Skip to first unread message

dazza

unread,
Jul 4, 2008, 8:30:22 AM7/4/08
to TurboGears
hi guys I've been testing my site with TG1.05 and I've come across a weird problem. I use Routes and I have unicode URLs. If I access http://localhost:8080/band/Motörhead all works fine, however if I am logged in I get the infamous

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)

The full trace is here: http://paste.turbogears.org/paste/3061

As I say when I log out it all works! My current fix is to define _cp_log_access in my root controller and make one small change http://paste.turbogears.org/paste/3062 on line 8 I explicitly create a unicode string from the request.line using utf8 encoding. I can do this because I know my URL's are utf8 (routes 1.9 default encoding I believe).

As part of the process I've moved from Routes 1.7 to Routes 1.9.1. reverting back to 1.7 doesn't seem to change anything.

So has anyone get any ideas why it works when NOT logged in and how I can close in on this issue?

--
blog: http://www.luckydonkey.com
work: http://www.newmetalarmy.com

Christoph Zwerschke

unread,
Jul 4, 2008, 9:37:35 AM7/4/08
to turbo...@googlegroups.com
dazza schrieb:

> So has anyone get any ideas why it works when NOT logged in and how I
> can close in on this issue?

I would replace the %s in the access log template string by %r and watch
for differences in the logged parameters when logged in. Or maybe you
configured it somehow so that access log runs only when logged in?

-- Chris

dazza

unread,
Jul 4, 2008, 6:58:09 PM7/4/08
to turbo...@googlegroups.com
%r: that's a great idea. I've done that and it's made no difference to the logged data (logged out followed by logged in):

2008-07-04 23:51:22,256 turbogears.access INFO  - -          "'GET /band/Mot\xc3\xb6rhead HTTP/1.1'" 200 22514 "" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9) Gecko/2008061004 Firefox/3.0"

2008-07-04 23:52:03,949 turbogears.access INFO  - metaldazza "'GET /band/Mot\xc3\xb6rhead HTTP/1.1'" 200 23378 "http://localhost:8080/login" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9) Gecko/2008061004 Firefox/3.0"

I've not accidentally changed the config to only log when logged in as the data above shows so I'm still stumped.

Thanks Christoph. Anyone got any more ideas?
Reply all
Reply to author
Forward
0 new messages