strip invalid utf8 sequences
implement P5rand