binaries with escaped chars are not formatted correctly by ~p #52

merged 2 commits into from May 17, 2012


None yet

3 participants


See here:

(lcmdr_server@> lager:log(error, self(), "~p", [<<"\"foo bar\"">>]).
11:14:41.527 [error] <<""foo bar"">>

Also here:

$ grep 'foo bar' log/*
log/console.log:2012-04-26 11:14:41.527 [error] <0.338.0> <<""foo bar"">>
log/error.log:2012-04-26 11:14:41.527 [error] <0.338.0> <<""foo bar"">>

I would expect to see something more like this:

(lcmdr_server@> io:format("~p~n", [<<"\"foo bar\"">>]).             
<<"\"foo bar\"">>

The same problem occurs with \ in the binary, but I noticed " first because it's most obvious in JSON strings.

This is the version I've got (should be the latest master):

$ (cd deps/lager; git rev-parse HEAD)

Same thing happens to lists that are treated like strings.

@Vagabond Vagabond was assigned Apr 26, 2012

How does that look?


You're missing a line:

escape($\v) -> "\\v";

Damn you vertical tab!

@metadave metadave was assigned May 17, 2012

Commits look all right and all tests pass.

@Vagabond Vagabond was assigned May 17, 2012
@Vagabond Vagabond merged commit 6faafc9 into master May 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment