﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18430	CachedFilesMixin crashed when CSS files contains non-ascii utf-8 character	brantyoung	Danilo Bargen	"Traceback (most recent call last):
{{{
...
...
  File "".../ENV/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py"", line 120, in collect
    for original_path, processed_path, processed in processor:
  File "".../ENV/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py"", line 226, in post_process
    content = pattern.sub(converter, content)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 366: ordinal not in range(128)
}}}

Reproduce：

# save a css file that contains non-ascii utf-8 character (ie Chinese character):
{{{
.icon-link:before { content: ""错""; }
}}}
# set ``STATICFILES_STORAGE`` to any storage class that will involve CachedFilesMixin mixin
# run ``manage.py collectstatic``

Howto fix:

I relace following code:

{{{
content = original_file.read().decode
}}}

to:

{{{
content = original_file.read().decode('utf-8')
}}}

just worked as expected."	Bug	closed	contrib.staticfiles	1.4	Normal	fixed			Unreviewed	0	0	0	0	1	0
