Description
It would be great if Salmon could be told to treat errors in byte decoding with something other than "strict". For example, it might be desirable to use "replace" instead if half an email was better than no email.
guess_encoding_and_decode
has an optional argument errors
which is set to DEFAULT_ERROR_HANDLING
by default. Because this is set in the function signature it's impossible to monkey-patch the default to some other value without monkey-patching the entire function.
I imagine this was the original intention behind errors
/DEFAULT_ERROR_HANDLING
as other variables can be monkey-patched at runtime in lieu of a proper settings sytems.
- Change the default value of
errors
toNone
and then seterrors
toDEFAULT_ERROR_HANDLING
iferrors
is stillNone
when the function is called. - Go up the function chain, all the way up to calls from
MailRequest
and give each one anerrors
argument. Also giveMailRequest
some property which can be set after object initialisation that controls the value oferrors
.
1 is required to be done to close this issue, 2 would be nice if there aren't too many functions between MailRequest
and guess_encoding_and_decode
Activity