Make std.utf.toUTFz safe and pure
Merge pull request #2023 from tom-tan/safe-pure-std-utf-toUTFz

Make std.utf.toUTFz safe and pure