I'm not sure how common this is but I have a correspondent who sends mail in UTF-7, a truly magnificent piece of horror, and my claws-mail can't render it on musl. I've written this patch based on RFC2152, though I'm not entirely certain I've covered all bases. I also find the code to be extremely kludgy as I was trying to not add any more variables to the top of iconv(). The basic premise is that scd->state contains a single bit to determine whether it's currently in a base64-encoded escape sequence, as well as how many (decoded) bits it has consumed from the byte it's currently looking at. If I understand correctly, encodings with an ID above 0330 are only supported for decoding. I have no need for encoding UTF-7 but I can write an encoder if that's desired, however I don't even think this decoder is in good enough condition to be committed as-is so I'm submitting it here for comments. I'm guessing that Rich might like it if the base64 table had all the -1 values at both ends chopped off. It does work with claws-mail and some more contrived and evil tests I've thrown at it.