I am using Base encode like below
enc = Base64.encode64(‘mystring’)
Output : "U2VuZCByZWluZm9yY2VtZW50cw==\n"
But when i use this output to set some div ids in the html page,
actual encryption is not shown. As you can see in the above sample, '\n' turns out to be a line break when using in html page. And the id of the div now becomes id="U2VuZCByZWluZm9yY2VtZW50cw=="
but expected is U2VuZCByZWluZm9yY2VtZW50cw==\n
is there any solution for this or any alternatives?
Try
It removes the new line and uses – instead of + and _ instead of /
You do of course then have to use
Base64.urlsafe_decode64to decode it.