Ack! My attempts to debug this algorithm are messed up still further by
the fact that your encoded version is still faulty. In particular, your
NEW example says:
Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8K?=
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLgo=?=
It turns out that the first variable encodes the following 30 characters:
If you can read this yo
Note that the 30th character is a newline! That is your encoding
actually includes a newline after the final "yo". It took me quite a
while to figure out that this was NOT a bug in my software. I suggest
that you change it to:
Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLgo=?=
At least this way, it doesn't produce a newline in the middle of its
output. My software currently produces the following from it:
Subject: [** ISO-8859-1 charset **] If you can read this yo u
understand the example.
(The above is all one line.) I still don't know how to get the "you" to
be a single word, given the white space on the header line, unless you
add some rules about it.
Turns out your example is a GREAT test case -- slightly pathological and
everything...