stringref icon indicating copy to clipboard operation
stringref copied to clipboard

string.new_lossy_utf8

Open annevk opened this issue 3 years ago • 1 comments

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.

annevk avatar Dec 02 '22 13:12 annevk

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?

dcodeIO avatar Dec 02 '22 15:12 dcodeIO