Add specs for writing StringIO with binary strings
Enable encoding specs for 1.9+ versions by default
Make StringIO operations byte based

StringIO works like an IO object and basically operates on strings as
them being byte arrays without encodings. This fixes a bunch of test
failures on Nokogiri as well, which uses a StringIO internally and got
results back with the wrong encoding.

Also fixes #2163 because the wrong encoding came out, because the
encoding aware methods used in StringIO before would change the encoding
if a ASCII-8BIT string was written to the StringIO. With this change,
they retain the original encoding, so things come out in the right
encoding from Nokogiri.