Commit 194004f5 by Caio Ariede Committed by Timothée Peignier

Fixes a bug when the file contains unicode data. #242

parent 6caa32c4
......@@ -236,4 +236,4 @@ class SubProcessCompressor(CompressorBase):
raise CompressorError(stderr)
if self.verbose:
print(stderr)
return stdout
return force_text(stdout)
.some_class {
// Some unicode
content: "áéíóú";
}
......@@ -2,6 +2,7 @@
from __future__ import unicode_literals
import base64
import os
try:
from mock import patch
......@@ -10,7 +11,8 @@ except ImportError:
from django.test import TestCase
from pipeline.compressors import Compressor, TEMPLATE_FUNC
from pipeline.compressors import Compressor, TEMPLATE_FUNC, \
SubProcessCompressor
from pipeline.compressors.yuglify import YuglifyCompressor
from tests.utils import _
......@@ -127,3 +129,14 @@ class CompressorTest(TestCase):
.no-protocol-url {
background-image: url(//images/sprite-buttons.png);
}""", output)
def test_compressor_subprocess_unicode(self):
tests_path = os.path.dirname(os.path.dirname(__file__))
output = SubProcessCompressor(False).execute_command(
'/usr/bin/env cat',
open(tests_path + '/assets/css/unicode.css').read())
self.assertEqual(""".some_class {
// Some unicode
content: "áéíóú";
}
""", output)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment