Skip to content

Commit 331e08d

Browse files
committed
Fix CSV writer to strip spaces off iolists
Previously it only stripped spaces off of the beginning/end of flat strings.
1 parent c38bb65 commit 331e08d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/clique_csv_writer.erl

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ format_val(V) when is_integer(V) ->
7272
format_val(V) when is_binary(V) ->
7373
format_val(unicode:characters_to_list(V, utf8));
7474
format_val(Str0) when is_list(Str0) ->
75-
Str = string:strip(Str0),
75+
%% TODO: This could probably be done more efficiently.
76+
%% Maybe we could write a strip func that works directly on iolists?
77+
Str = string:strip(binary_to_list(iolist_to_binary(Str0))),
7678
%% If we have any line breaks, double quotes, or commas, we must surround the value with
7779
%% double quotes.
7880
IsEvilChar = fun(C) -> lists:member(C, [$\r, $\n, $", $,]) end,

0 commit comments

Comments
 (0)