Make sure that the Encoding check does not modify the given string

this partially reverts 6ce26c83ad851bf19741d9682633c6517764e8b0
see: https://github.com/haml/haml/commit/6ce26c83ad851bf19741d9682633c6517764e8b0#commitcomment-2586688