It looks like the source of the problem here is that the encoding that the mail client specified isn't a standard one. Specifically, it mentions "windows-874" when it looks like the appropriate one is "cp874". We can create our own encoding alias table for these mappings, or we can try a strategy of replacing the encoding names, since it looks like the aliases form a pattern:
encoding.replace("windows-", "cp").
The replace idea might prevent some future problems, but I'm not 100% sure that it won't introduce its own side effect. The lookup table is more explicit but requires us to react to errors as they come in. That being said, I don't think we're getting a flood of these errors all with different unknown encodings, so it's probably sufficient anyway.
It looks like the source of the problem here is that the encoding that the mail client specified isn't a standard one. Specifically, it mentions "windows-874" when it looks like the appropriate one is "cp874". We can create our own encoding alias table for these mappings, or we can try a strategy of replacing the encoding names, since it looks like the aliases form a pattern: replace( "windows- ", "cp").
encoding.
The replace idea might prevent some future problems, but I'm not 100% sure that it won't introduce its own side effect. The lookup table is more explicit but requires us to react to errors as they come in. That being said, I don't think we're getting a flood of these errors all with different unknown encodings, so it's probably sufficient anyway.