Skip to content

Commit

Permalink
Little more verbose permissive header decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
seriyps committed Dec 29, 2013
1 parent 112b9a3 commit 3c09e00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mimemail.erl
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ decode_header_tokens_strict([Data | Tokens], Charset) ->
%% this decoder can handle folded not-by-RFC UTF headers, when somebody split
%% multibyte string not by characters, but by bytes. It first join folded
%% string and only then decode it with iconv.
decode_header_tokens_permissive([], _, Stack) ->
lists:reverse(Stack);
decode_header_tokens_permissive([], _, [Result]) when is_binary(Result) ->
Result;
decode_header_tokens_permissive([], _, []) ->
[];
decode_header_tokens_permissive([{Enc, Data} | Tokens], Charset, [{Enc, PrevData} | Stack]) ->
NewData = iolist_to_binary([PrevData, Data]),
case convert(Charset, Enc, NewData) of
Expand Down

0 comments on commit 3c09e00

Please sign in to comment.