** (ArgumentError) non-alphabet digit found: "=" (byte 61)
(elixir) lib/base.ex:111: Base."-do_decode64/1-lbc$^0/2-0-"/2
(elixir) lib/base.ex:547: Base.do_decode64/1
I'm guessing this has something to do with UTF-8 vs. ASCII -- is there a way to change the target encoding?
Brad
iex> txt = Base.encode64("any carnal pleas")
"YW55IGNhcm5hbCBwbGVhcw=="
iex> Base.decode64!(txt)
"any carnal pleas"
iex> Base.decode64!(txt<>txt)
** (ArgumentError) non-alphabet digit found: "=" (byte 61)
(elixir) lib/base.ex:111: Base."-do_decode64/1-lbc$^0/2-0-"/2
(elixir) lib/base.ex:547: Base.do_decode64/1
iex()> txt = Base.encode64("any carnal pleasur")
"YW55IGNhcm5hbCBwbGVhc3Vy"
iex()> Base.decode64!(txt<>txt)
"any carnal pleasurany carnal pleasur"
As Paulo Almeida said, the "=" sign is used for padding and should be found only at the end of the encoded string.Check if you are concatenating encoded strings before decoding :)
"MC4wCg==DQo=“
I'm guessing that the problem is that "DQo" is interspersed amongst the padding, and that is causing the parser to crash. I'd be interested in others' opinions -- I'd guess that padding shouldn't have data in it.
Brad