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): ...@@ -236,4 +236,4 @@ class SubProcessCompressor(CompressorBase):
raise CompressorError(stderr) raise CompressorError(stderr)
if self.verbose: if self.verbose:
print(stderr) print(stderr)
return stdout return force_text(stdout)
.some_class {
// Some unicode
content: "áéíóú";
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import base64 import base64
import os
try: try:
from mock import patch from mock import patch
...@@ -10,7 +11,8 @@ except ImportError: ...@@ -10,7 +11,8 @@ except ImportError:
from django.test import TestCase 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 pipeline.compressors.yuglify import YuglifyCompressor
from tests.utils import _ from tests.utils import _
...@@ -127,3 +129,14 @@ class CompressorTest(TestCase): ...@@ -127,3 +129,14 @@ class CompressorTest(TestCase):
.no-protocol-url { .no-protocol-url {
background-image: url(//images/sprite-buttons.png); background-image: url(//images/sprite-buttons.png);
}""", output) }""", 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