My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 644: Atom.url.Url.get_param_string can not handle unicode parms
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by george...@gmail.com, Oct 25, 2012
following patch might helps:

diff -r a8c25010b8b7 src/atom/url.py
--- a/src/atom/url.py	Mon Aug 27 13:50:08 2012 -0700
+++ b/src/atom/url.py	Thu Oct 25 19:47:55 2012 +0800
@@ -87,10 +87,17 @@
     return urlparse.urlunparse(url_parts)
 
   def get_param_string(self):
+    def _str(s):
+      if isinstance(s, unicode):
+        s = s.encode('utf-8', 'ignore')
+      else:
+        s = str(s)
+      return s
+            
     param_pairs = []
     for key, value in self.params.iteritems():
       param_pairs.append('='.join((urllib.quote_plus(key), 
-          urllib.quote_plus(str(value)))))
+          urllib.quote_plus(_str(value)))))
     return '&'.join(param_pairs)
 
   def get_request_uri(self):
Sign in to add a comment

Powered by Google Project Hosting