I've now added an additional patch which automatically handles unix/dos eol-types when downloading/uploading sieve scripts. So far, if a script downloaded from the server contained CRLF EOLs, the script buffer was full of '^M's. With the additional patch (0005-Autodetect-eol-type-of-sieve-manage-scripts), the EOL type is detected and used for decoding during script download (and subsequently also for encoding during upload). For that, I changed the interface between 'sieve-upload' (in sieve.el), and 'manage-sieve-putscript' (plus 'sieve-manage-decode' and 'sieve-manage-send' in sieve-manage.el). Instead of transferring the script data as a string, the functions are now using the actual script buffer. The eol-type detection is done in the new function 'sieve-manage--guess-buffer-coding-system'. But I would assume, that this functionality already exists somewhere else. E.g. 'find-file' must do a similar, much more detailed analysis. However, that seems to happen in the C implementation, so it's not directly usable in sieve-manage. Or am I missing something?