Is this a Base64 bug?

I was struggling with an API call that required Basic Auth. I discovered that Base64 encoding was adding a linefeed “\n” to my Base64 encoded text. Looks like once it gets to a certain length, a line feed is inserted. Not sure if this is a bug or if I am over looking something? I did figure out a work around with “replace all text”. Attached sample blocks with sample values, a screenshot and an aia file. Text_Box1 shows the linefeed added and the fixed output in Text_Box2.

Base64_Test.aia (2.4 KB)

Can you use “Do It” to paste here the raw string both original and Base64?

Took me a bit to figure out how to get a “Do It” result.

Do It Result: a1bcf4fc-abd1-11ea-bb37-0242ac130002:XR2f8975b53a684cc5cfb7e7cd54fab869deb654bfc3c7d5f6

Do It Result: YTFiY2Y0ZmMtYWJkMS0xMWVhLWJiMzctMDI0MmFjMTMwMDAyOlhSMmY4OTc1YjUzYTY4NGNjNWNm
YjdlN2NkNTRmYWI4NjlkZWI2NTRiZmMzYzdkNWY2


You are right. After a quick research, I found that Base64 encoding inserts a newline after every 76 characters.

This seems to be best possible way to remove newlines from encode Base64 string.

1 Like

Thanks @pavi2410 for looking into this. Maybe this discussion will save someone else from similar frustrations. Or a note in the Base64 documentation might be helpful.

1 Like