Inspired by ICU, something like:
buf = iconv.encode(str, 'win1251', { invalidCharHandler: function(char) {
// Here you can either throw exception which will be propagated outside,
// or return a replacement char.
});
Probably, some default handlers would also be nice (always throwing, always returning '?', trying to transliterate).
Inspired by ICU, something like:
Probably, some default handlers would also be nice (always throwing, always returning '?', trying to transliterate).