Fix #1222, StringIO.gets w/ utf8
Merge with 1.7