Skip to content

Commit

Permalink
Merge pull request #2 from discoverygarden/unicode_url_params
Browse files Browse the repository at this point in the history
better unicode support
  • Loading branch information
willtp87 committed Jun 19, 2012
2 parents 499d876 + a4da8c3 commit 346ca4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/fcrepo/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def open(self, url, body='', headers=None, method='GET',):
try:
logging.debug('Trying %s on %s' % (method, url))
#we can't have unicode characters floating around in the body
if isinstance(body, basestring):
body=body.encode('ascii','xmlcharrefreplace')
self.conn.request(method, url, body, headers)
return check_response_status(self.conn.getresponse())
except (socket.error,
Expand Down
5 changes: 5 additions & 0 deletions src/fcrepo/wadl.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def submit(self, body='', **params):
for param, value in self.undocumented_params.items():
if not param in qs:
qs[param] = value

#change to utf8 to let unicode pass through urlencode
for key in qs:
qs[key] = qs[key].encode('utf8')

if qs:
self.url = '%s?%s' % (self.url, urllib.urlencode(qs))

Expand Down

0 comments on commit 346ca4d

Please sign in to comment.