From bc421aba88bc1cc5a1f9b3a07b5e545124c3d08d Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 19 May 2011 11:11:17 +0200 Subject: [PATCH] Stopped turn the hunk values into unicode if already unicode. Fixes #49. --- compressor/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compressor/base.py b/compressor/base.py index 647d49b..5562bba 100644 --- a/compressor/base.py +++ b/compressor/base.py @@ -2,6 +2,7 @@ import os from django.core.files.base import ContentFile from django.template.loader import render_to_string +from django.utils.encoding import smart_unicode from compressor.cache import get_hexdigest, get_mtime from compressor.conf import settings @@ -94,7 +95,7 @@ class Compressor(object): if kind == SOURCE_HUNK: content = self.filter(value, METHOD_INPUT, elem=elem, kind=kind, basename=basename) - yield unicode(content) + yield smart_unicode(content) elif kind == SOURCE_FILE: content = "" fd = open(value, 'rb') @@ -109,7 +110,7 @@ class Compressor(object): filename=value, basename=basename, elem=elem, kind=kind) attribs = self.parser.elem_attribs(elem) charset = attribs.get("charset", self.charset) - yield unicode(content, charset) + yield smart_unicode(content, charset.lower()) @cached_property def concat(self):