User bio
404 bio not found
Member since Dec 4, 2015

I think the 4000 character read from the unencoded source is the problem.  That's not an "even number" for base64 encoding, meaning that the encoded version will have trailing "=" signs as padding, in this case 2 of them.

Changing to 3000 characters got it to work for me, meaning that the encoded chunks did not have trailing "=".

An easy test is to look at your final encoded text.  If you see "=" chars anywhere except the end, this is your problem.

The trailing "=" is a problem because when you concatenate the encoded chunks those end up embedded in the result, making it invalid base64.  You need to rig it so you don't get trailing "=" for any chunk except the last one.  You do that by ensuring that your unconverted chunks have a number of bytes such that the bit count is divisible by 6.

This is helpful, but I feel like it's still just a workaround for the real problem, which is that the compiler is reformatting code.  Even if I allow that the compiler knows more about how code should be formatted than I do (it doesn't, if only because correct formatting is defined by personal opinion), it shouldn't be doing that until it's fully parsed and validated the code.  If it hasn't successfully parsed the code it can't possibly make good decisions about how it should be formatted.

Certifications & Credly badges:
Clayton has no Certifications & Credly badges yet.
Global Masters badges:
Clayton has no Global Masters badges yet.
Clayton has no followers yet.
Clayton has not followed anybody yet.