base64 encode multiple lines

I’m trying to base64 encode the contents of a file that contains multiple lines. The problem I’m having is that the “base64 encode” inspector only converts a single string, I can concatenate all the lines of the file together, but then I lose the formatting of the file contents. Any suggestions?

base64 encode (concatenation of lines of file "c:\test.txt")

Would something like this work?

base64 encode (concatenation "%0d%0a" of lines of file "c:\test.txt")

2 Likes

that works great. I changed it to a single line return though ("%0d"). thanks

2 Likes

Depending on what you were trying to do I suppose you could also substring it back out…

substrings separated by "%0d%0a" of (base64 decode (base64 encode (concatenation "%0D%0A" of lines of file "c:\test.txt")))

1 Like

%0d%0a should be a single line return on windows. Line breaks are weird and non-standard.

1 Like