Skip to content

Formatting/debug of OS strings #22766

Closed
Closed
@SimonSapin

Description

@SimonSapin

OsStr implements fmt::Debug:

  • On Unix, using to_lossy_str, then fmt::Debug::fmt on the resulting String, which escapes all control or non-ASCII characters.
  • On Windows, it eventually calls an impl I originally wrote for rust-wft8, which is lossless but only escapes surrogate code points. In particular, it happily prints control characters.

So there are two issues: they should be consistent across platforms, and is it OK for a Debug impl to be lossy?

CC @aturon, @alexcrichton

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-acceptedCategory: A feature request that has been accepted pending implementation.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions