Skip to content

Commit

Permalink
Merge pull request #482 from okpy/master
Browse files Browse the repository at this point in the history
Decode fetched files as UTF-8
  • Loading branch information
miracle2k committed Feb 3, 2018
2 parents b7818e0 + 978b806 commit dfb5e70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webassets/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from urllib2 import HTTPError
import logging
from io import open
from webassets import six
from webassets.six.moves import filter

from .utils import cmp_debug_levels, StringIO, hash_func
Expand Down Expand Up @@ -119,7 +120,10 @@ def data(self):
self._data = self.env.cache.get(('url', 'contents', self.url))
else:
with contextlib.closing(response):
self._data = response.read()
data = response.read()
if isinstance(data, six.binary_type):
data = data.decode('utf-8')
self._data = data

# Cache the info from this request
if self.env and self.env.cache:
Expand Down

0 comments on commit dfb5e70

Please sign in to comment.