sstephenson/sprockets — pull request #419 by lmars (2013-03-10 00:46:28+00:00)
Title: Make the DirectiveProcessor encoding aware

In Ruby 1.9, the directive_processor.rb source file defaults to US-ASCII
as it doesn't contain a magic comment, meaning the String initialised in
`@result` gets a US-ASCII encoding.

This means that when content is concatenated onto `@result` (e.g. in
process_source), Ruby will maintain the US-ASCII encoding, provided the
content being concatenated contains no non-ascii chars.

The changes in this commit force the encoding of the resulting string to
be that of the body, because conceptually that is the string we are
"concatenating" with.

The test I have added is quite high level (i.e. it doens't refer directly to the directive processor), but it fails with "invalid byte sequnce" without it, so I assume it is testing the change I have made :wink: