Fix RangesIO#write corrupting the output file when passed an UTF8-encode...

...d string