Skip to content

Improve output for strings #220

@Jakeroid

Description

@Jakeroid

Issue

Characters inside strings can modify their output by default. This leads to lost or misleading information when debugging.

Proposed Solution

Make IceCream output strings in a way that preserves all information by default.
That means:

  • Showing control characters and invisibles explicitly instead of letting them affect terminal layout.
  • Deciding carefully whether newlines should render literally or as escaped symbols.

Examples

  1. Control characters alter the output instead of being visible.
    For instance, \b (backspace) removes characters → abc\bX prints as abX (information lost).
  2. Invisible Unicode characters disappear silently.
    For instance, Zero-width space (\u200B), left/right marks (\u200E, \u200F) are not shown → the user cannot tell they exist.
  3. Newlines are always shown as multi-line blocks.
    I’m not confident this should be the default behavior.
  4. Whitespace is ambiguous.
    For instance, tabs (\t) are expanded into spaces, making them indistinguishable.
  5. Long strings flood the output.
    Very long lines are printed in full without truncation or summary.
  6. Bytes / bytearray with control characters.
    For instance, bytes with \n or \x00 are printed raw, producing real line breaks or invisible content.

Open Questions

  1. Should escaped/visible mode be the default behavior?
  2. Should there be an option to output strings in a more readable form than one huge single line?
  3. Do we want to summarize long strings (length, line count, preview) instead of printing the full content by default?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions