From 978b8063ce80c7f91c6bf080872dafe4eecf2454 Mon Sep 17 00:00:00 2001 From: Kyle Raftogianis Date: Tue, 17 Jan 2017 20:50:06 -0800 Subject: [PATCH] Decode fetched files as UTF-8 --- src/webassets/merge.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webassets/merge.py b/src/webassets/merge.py index cecd0d60..3d70bffb 100644 --- a/src/webassets/merge.py +++ b/src/webassets/merge.py @@ -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 @@ -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: