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
{{ message }}
This repository was archived by the owner on Mar 31, 2023. It is now read-only.
Describe the bug JSONFormat is expected to output JSON regardless of the input data, but outputs non-JSON on some special characters; \x00, \a, \v, \U0001FBFF.
{"topic":"main","logged_at":"2022-03-15T06:39:16.059075Z","severity":"debug","utsname":"test","message":"test","x":"\x00\a\v\U0001fbff"}
invalid character 'x' in string escape code
exit status 1
Expected behavior JSONFormat emits valid JSON even if the input data contains non-printable characters, and the output is safely decoded back to the data.
Additional context
Currently this formatter uses strconv.AppendQuote to encode string values. This method is intended to output Go string literal representation, which allows wider range of character representation than JSON. For example, "\x00\a\v\U0001FBFF" is a valid Go string literal, but its quoted value "\"\\x00\\a\\v\\U0001fbff\"" is not a valid JSON.
The text was updated successfully, but these errors were encountered:
Describe the bug
JSONFormat
is expected to output JSON regardless of the input data, but outputs non-JSON on some special characters;\x00
,\a
,\v
,\U0001FBFF
.Environments
To Reproduce
Steps to reproduce the behavior:
Run following code.
Get following output.
Expected behavior
JSONFormat
emits valid JSON even if the input data contains non-printable characters, and the output is safely decoded back to the data.Additional context
Currently this formatter uses
strconv.AppendQuote
to encode string values. This method is intended to output Go string literal representation, which allows wider range of character representation than JSON. For example,"\x00\a\v\U0001FBFF"
is a valid Go string literal, but its quoted value"\"\\x00\\a\\v\\U0001fbff\""
is not a valid JSON.The text was updated successfully, but these errors were encountered: