Base64 with newlines

What's the best way to process base64 with newlines, e.g. that from email? The base64 crate seems designed to NOT support base64 as seen in email. Unfortunately it seems to be the only base64 crate anyone uses.

I'm not sure if I'm understanding correctly, but it sounds like you could just filter out newlines and then use the base64 crate

Yeah that's what we're currently doing: - source

Still, it is sad that the base64 crate can't accept base64's output.

It's not a huge deal, but I think you can improve that function by parsing an iterator of u8 instead of collecting back into a String after removing the newlines. As you've written it now, it has a suboptimal space complexity. Also, there's no need for the 'static lifetime constraint on the input to that function.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.