Fix an issue with using ascii encoding internally

Also this describes some of the expected behaviour for differently
encoded strings.
change to splitting directly on string
add an encoding notice for this file, might fix the travis build issue (linux)
matching formatting to convention
attempt 2 at fixing travis
fix encoding regression caused by shadowing variables and some typos
handle compatibility errors and increase test coverage
Merge pull request #220 from JonRowe/fix_internal_encoding_error

Encode diff literals according to the actual output encoding.