quoteIfNeeded leaves invalid UTF-8 bare, so raw invalid bytes reach the terminal #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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