--On Saturday, February 13, 2016 05:59 +0000 Jasen Betts
<jasen@???> wrote:
>> The file might contain some user-specific encoding (ISO 8859-1
>> or UTF8 or something else). Is there a simple way to detect
>> and add the proper MIME headers needed to properly encode the
>> reply ?
>
> character encoding cannot be reliably autodetected.
Actually a little bit of an understatement. There are some
heuristics for detecting UTF-8. Opinions seem to differ about
how effective they are and I'm seen estimated from 40% - 90%
success. On the other hand, there is no plausible way (at least
without detection of language in large bodies of text, which is
part of some of the UTF-8-detection heuristics too) to
distinguish one CCS in the 8859 series from another and the
effects of getting it wrong can be quite significant.
Even trying is probably a bad idea.
john