Skip to content

fmt::Debug should not escape printable characters #24588

Closed
@pnkfelix

Description

@pnkfelix
Member

(imported from improperly closed bug #22412)

pub fn main() {
    println!("{}", "äöüß");
    println!("{:?}", "äöüß");
}

prints:

äöüß
"\u{e4}\u{f6}\u{fc}\u{df}"

but probably should print:

äöüß
"äöüß"

(See discussion on #22412 for strategies for fixing this; team seemed pretty much on board for this change.)

Activity

steveklabnik

steveklabnik commented on Jun 6, 2016

@steveklabnik
Member

Triage: no change. I do wonder about this kind of change with regards to stability though.

estebank

estebank commented on Nov 15, 2016

@estebank
Contributor

I see where the sentiment comes from, but do consider that there're multiple ways to encode the same visual output. Debug using the \u{} format for those characters helps differentiate easily between ö and , for example.

bluss

bluss commented on Nov 15, 2016

@bluss
Member

This was fixed in #34485 and the examples in the original report have the desired output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@pnkfelix@estebank@bluss

        Issue actions

          `fmt::Debug` should not escape printable characters · Issue #24588 · rust-lang/rust