Skip to content

Commit

Permalink
Decoding iso-8859 text
Browse files Browse the repository at this point in the history
  • Loading branch information
ezturner committed Sep 24, 2019
1 parent d885501 commit 7d1d94e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions uw_bookstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ def get_books_by_quarter_sln(self, quarter, sln):
quarter,
self._get_sln_string(sln),
)
response = DAO.getURL(url, {"Accept": "application/json"})
response = DAO.getURL(url, {"Accept": "application/json", "Accept-Charset": "utf-8"})

if response.status != 200:
raise DataFailureException(url, response.status, response.data)

utf_data = response.data.decode("iso-8859-1").encode('utf8')
data = json.loads(response.data)

books = []
Expand Down Expand Up @@ -85,7 +87,7 @@ def get_url_for_schedule(self, schedule):
url = self._get_url(schedule)
if url is None:
return None
response = DAO.getURL(url, {"Accept": "application/json"})
response = DAO.getURL(url, {"Accept": "application/json", "Accept-Charset": "utf-8"})
if response.status != 200:
raise DataFailureException(url, response.status, response.data)

Expand Down

0 comments on commit 7d1d94e

Please sign in to comment.