stringref
stringref copied to clipboard
string.new_lossy_utf8
It seems weird to give what's commonly the default behavior for UTF-8 decoding the longer name.
Also, I would be much more comfortable if this referenced https://encoding.spec.whatwg.org/#utf-8-decode. We don't really want other decoding behavior and Unicode historically gave other options here.
Seems reasonable to drop string.new_utf8 and have string.new_utf8_lossy take its place, given that there is nothing useful one can do with a trap anyway. Perhaps, a mechanism to tell, after the fact, whether replacement was performed, would provide more useful utility, as it could be utilized to trap, warn or raise an exception?