IO#read(length) is not UTF-8 safe. It can truncate UTF-8 characters and lead to errors in the compressor like: Compression failed: "\xE2" from ASCII-8BIT to UTF-8
I removed the length parameters which causes Ruby to read the entire stream in one go. This may require more system resources for very large CSS/JS files
but will not fail for UTF-8 files.