Hi Gregg,

This seems like a legitimate bug -- good find. A quick fix if you're
looking to get something working is this:

--- a/web/application.py
+++ b/web/application.py
@@ -427,7 +427,7 @@ class application:
                 else:
                     continue
             elif isinstance(what, basestring):
-                what, result = utils.re_subm('^' + pat + '$', what,
value)
+                what, result = utils.re_subm(u'^' + safeunicode(pat)
+ u'$', what, value)
             else:
                 result = utils.re_compile('^' + pat +
'$').match(value)



This has a slight performance penalty however -- safeunicode gets
called for each url regex on every request. Anand: is there a cleaner
way to do this? It would be easy enough to do that once when the url
list is loaded, but I'm not an expert with the encoding architecture.

Cheers,
Justin


On Aug 14, 11:20 am, Gregg Lind <[email protected]> wrote:
> So, unicode in URLs cause some complications.  How does one make this
> work?
>
> --------------------------------------
> #!/usr/bin/python
> # -*- coding: utf8 -*-
>
> import web
>
> urls = (
>   '/test/mío','Blah',
>   '/test/mio','Blah',
> )
>
> app = web.application(urls, globals())
>
> class Blah(object):
>     def GET(self):
>         web.header("Content-Type","text/html; charset=utf-8")
>         return "<html><body>BLAH!</body></html>"
>
> if __name__ == "__main__":
>     web.config.debug = True
>     app.run()
> -----------------http://gist.github.com/524549

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to