You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, any encode/decode function pairs should be idempotent; that is, this should always be true:
x == decode(encode(x))
It appears to not be the case with encode_logfmt and parse_logfmt, as demonstrated here, where result.key has additional escape characters.
Taken to the extreme:
.obj.key = s'this has a " quote'
parse_logfmt!(encode_logfmt(parse_logfmt!(encode_logfmt(parse_logfmt!(encode_logfmt(parse_logfmt!(encode_logfmt(parse_logfmt!(encode_logfmt(.obj))))))))))
yields:
{ "key": "this has a \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" quote" }
This isn't really causing me any headaches, and the fact that it hasn't been raised yet probably indicates the same for other folks, just thought it was worth bringing up, as I stumbled on it today.
The text was updated successfully, but these errors were encountered:
I got a test reproducing the error this evening. The problem is the same in both directions: encode(decode()) decode(encode())
decoding does not remove escape characters.
encoding escapes " and \ characters. EDIT: also \n characters.
Either decoding should parse and remove the escape characters, or encoding should not add escape characters.
I've been testing the encode/decode value functions, so I don't think it's just the logfmt functions.
In general, any encode/decode function pairs should be idempotent; that is, this should always be true:
It appears to not be the case with
encode_logfmt
andparse_logfmt
, as demonstrated here, whereresult.key
has additional escape characters.Taken to the extreme:
yields:
This isn't really causing me any headaches, and the fact that it hasn't been raised yet probably indicates the same for other folks, just thought it was worth bringing up, as I stumbled on it today.
The text was updated successfully, but these errors were encountered: