str: stop encoding invalid out-of-range `char`
auto merge of #7612 : thestinger/rust/utf8, r=huonw