Found reviewing #21
(#21 (comment)). Pre-existing
for values; that PR extended quoteIfNeeded to keys, which is how it surfaced.
quoteIfNeeded quotes on delimiter ambiguity, and unicode.IsPrint treats
U+FFFD as printable, so a string containing an invalid UTF-8 byte stays bare.
Console output is bad\xffkey=v where slog.NewTextHandler emits "bad\xffkey"=v.
The consequence is not parse ambiguity — bad\xffkey=v still splits correctly —
but that a raw invalid byte reaches the terminal and any UTF-8-strict consumer.
Definition of done
Invalid UTF-8 is quoted rather than emitted raw, matching slog.NewTextHandler.
Applied consistently to keys and values: quoteIfNeeded serves both, so a
fix to one changes the other. A differential against slog.NewTextHandler
covering both is the evidence.
Valid non-ASCII stays unquoted where stdlib leaves it unquoted — do not fix
this by quoting everything non-ASCII.
Implementation requirements
Do not change WithGroup("") behaviour; its divergence from slog.NewJSONHandler is deliberate and was confirmed twice.
Landing commit title must end with (closes #24).
Found reviewing https://git.eeqj.de/sneak/simplelog/pulls/21
(https://git.eeqj.de/sneak/simplelog/pulls/21#issuecomment-54029). Pre-existing
for values; that PR extended `quoteIfNeeded` to keys, which is how it surfaced.
`quoteIfNeeded` quotes on delimiter ambiguity, and `unicode.IsPrint` treats
U+FFFD as printable, so a string containing an invalid UTF-8 byte stays bare.
Console output is `bad\xffkey=v` where `slog.NewTextHandler` emits
`"bad\xffkey"=v`.
The consequence is not parse ambiguity — `bad\xffkey=v` still splits correctly —
but that a raw invalid byte reaches the terminal and any UTF-8-strict consumer.
## Definition of done
- Invalid UTF-8 is quoted rather than emitted raw, matching
`slog.NewTextHandler`.
- Applied consistently to keys **and** values: `quoteIfNeeded` serves both, so a
fix to one changes the other. A differential against `slog.NewTextHandler`
covering both is the evidence.
- Valid non-ASCII stays unquoted where stdlib leaves it unquoted — do not fix
this by quoting everything non-ASCII.
## Implementation requirements
- Do not change `WithGroup("")` behaviour; its divergence from
`slog.NewJSONHandler` is deliberate and was confirmed twice.
- Landing commit title must end with ` (closes #24)`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found reviewing #21
(#21 (comment)). Pre-existing
for values; that PR extended
quoteIfNeededto keys, which is how it surfaced.quoteIfNeededquotes on delimiter ambiguity, andunicode.IsPrinttreatsU+FFFD as printable, so a string containing an invalid UTF-8 byte stays bare.
Console output is
bad\xffkey=vwhereslog.NewTextHandleremits"bad\xffkey"=v.The consequence is not parse ambiguity —
bad\xffkey=vstill splits correctly —but that a raw invalid byte reaches the terminal and any UTF-8-strict consumer.
Definition of done
slog.NewTextHandler.quoteIfNeededserves both, so afix to one changes the other. A differential against
slog.NewTextHandlercovering both is the evidence.
this by quoting everything non-ASCII.
Implementation requirements
WithGroup("")behaviour; its divergence fromslog.NewJSONHandleris deliberate and was confirmed twice.(closes #24).work this into 21