Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240831105243.2a396d84@eclair>
Date: Sat, 31 Aug 2024 10:52:43 +0200
From: Joakim Sindholt <opensource@...sha.com>
To: musl@...ts.openwall.com
Subject: UTF-7 decoder in iconv

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.

View attachment "iconv.diff" of type "text/x-patch" (3807 bytes)

View attachment "utf7.c" of type "text/x-c++src" (840 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.