encode command to ascii-8bit when on jruby

I found out that the command needs to be encoded with ascii-8bit when using jruby. Otherwise the multibyte characters are not correctly interpreted.

I do not know if this encoding should be done when using jruby on windows but the current implementation will do it anyway.

This relates to an issue in paperclip https://github.com/thoughtbot/paperclip/issues/1702
It looks like the git ls-files messes up with the encoding. -z solves that. But this whole change can be avoided if the test file is created temporarily in the test. But as the issue will soon be fixed in JRuby, it is barely worth adding this into the project.