nickesk / pyactiveresource

Automatically exported from code.google.com/p/pyactiveresource
Other
0 stars 0 forks source link

Encoding problem #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a unicode value (with an accent) as a url param

What is the expected output? What do you see instead?
Urlencoding should work flawlessly, instead there is an encoding error :

File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", 
line 359, in 
find_first
   resources = cls._find_every(from_=from_, **kwargs)

 File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 473, in 
_find_every
   path = from_ + cls._query_string(kwargs)

 File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 521, in 
_query_string
   return '?' + urllib.urlencode(query_options)

 File "/usr/lib/python2.5/urllib.py", line 1250, in urlencode
   v = quote_plus(str(v))

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 6: 
ordinal not in 
range(128)

I've attached a patch that fix it (without unit test and a bit hackish).

Original issue reported on code.google.com by timothee...@gmail.com on 25 Jun 2009 at 6:44

Attachments:

GoogleCodeExporter commented 9 years ago
This was fixed with r53
http://code.google.com/p/pyactiveresource/source/detail?r=53

Original comment by mark.r.r...@gmail.com on 17 Nov 2009 at 9:03