fixed #276.
authorArmin Ronacher <armin.ronacher@active-4.com>
Tue, 11 Sep 2007 11:51:57 +0000 (13:51 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Tue, 11 Sep 2007 11:51:57 +0000 (13:51 +0200)
--HG--
branch : trunk

jinja/filters.py

index af05a0edd094099e9b28a96df1c715cbda3199d1..f9199a6bc0f6fd66cba13be2914a72c42c6d8ea8 100644 (file)
@@ -375,10 +375,12 @@ def do_urlencode():
         if isinstance(value, dict):
             tmp = {}
             for key, value in value.iteritems():
-                tmp[env.to_unicode(key)] = env.to_unicode(value)
+                key = env.to_unicode(key).encode(env.charset)
+                value = env.to_unicode(value).encode(env.charset)
+                tmp[key] = value
             return urlencode(tmp)
         else:
-            return quote(env.to_unicode(value))
+            return quote(env.to_unicode(value).encode(env.charset))
     return wrapped