[erlang-patches] base64:decode trailing whitespace patch for otp_src_R13B/lib/stdlib/src/base64.erl

Igor Goryachev <>
Mon Apr 27 18:10:50 CEST 2009


Christopher Stelma <> writes:

> Trailing whitespace (after "=") is stripped, but the return value from
> base64:strip_spaces is not in the same format expected by
> base64:decode.
>
> example of the problem:
>
> ----------------------------------------------------------------------
> 3> base64:decode("cXV1eA==").
> <<"quux">>
> 4> base64:decode("cXV1eA==\n").
> ** exception error: no function clause matching
> base64:decode([61,"=Ae1VXc"],
>
> {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
>
> -1,-1,-1,-1,-1,-1,-1,-1,...},
>                                                               [])
>     in function  base64:decode/1
> ----------------------------------------------------------------------

Hello, Christopher!

Doesn't base64:mime_decode/1 make deal?

% erl
Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false]

Eshell V5.6.3  (abort with ^G)
1> base64:mime_decode("cXV1eA==\n").
<<"quux">>
2>


-- 
Igor Goryachev
Yandex development team.



More information about the erlang-patches mailing list