Skip to content

Commit

Permalink
Make unicode searches work no matter environment locale. fix wagnerrp#39
Browse files Browse the repository at this point in the history
  • Loading branch information
gazpachoking committed Jan 18, 2015
1 parent 3fb9398 commit 90f5098
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tmdb3/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def __init__(self, url, **kwargs):
self._kwargs = dict([(kwa, kwv) for kwa, kwv in kwargs.items()
if kwv is not None])

locale = get_locale()
kwargs = {}
for k, v in self._kwargs.items():
kwargs[k] = locale.encode(v)
if isinstance(v, unicode):
kwargs[k] = v.encode('utf-8')
else:
kwargs[k] = str(v)
url = '{0}{1}?{2}'\
.format(self._base_url, self._url, urlencode(kwargs))

Expand Down

0 comments on commit 90f5098

Please sign in to comment.