← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pappacena/launchpad:fix-encoding-css-combine into launchpad:master

 

Thiago F. Pappacena has proposed merging ~pappacena/launchpad:fix-encoding-css-combine into launchpad:master.

Commit message:
Fix for encoding problem when combining CSS files with non-ascii chars

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/377331

Avoiding the exception bellow:

Traceback (most recent call last):
  File "bin/combine-css", line 8, in <module>
    sys.exit(lp.scripts.utilities.js.combinecss.main())
  File "/home/pappacena/launchpad/launchpad/lib/lp/scripts/utilities/js/combinecss.py", line 81, in main
    result += content
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 6365: ordinal not in range(128)
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:fix-encoding-css-combine into launchpad:master.
diff --git a/lib/lp/scripts/utilities/js/combinecss.py b/lib/lp/scripts/utilities/js/combinecss.py
index 1aa1072..1bb94c2 100755
--- a/lib/lp/scripts/utilities/js/combinecss.py
+++ b/lib/lp/scripts/utilities/js/combinecss.py
@@ -75,9 +75,9 @@ def main():
 
     combo = ComboFile(absolute_names, target)
     if combo.needs_update():
-        result = ''
+        result = u''
         for content in combine_files(names, icing):
-            result += content
+            result += content.decode('utf8')
 
         with open(target, 'w') as f:
-            f.write(result)
+            f.write(result.encode('utf8'))

Follow ups