Uh oh!
There was an error while loading. Please reload this page.
Use non-local OS error strings (en-US) - #34422
Conversation
rust-highfive
commented
Jun 23, 2016
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
tbu-
commented
Jun 23, 2016
Is there precedence of other programming languages doing this? From the top of my head, I only know that Python doesn't. I don't think this is a good idea, we shouldn't impose English upon the user. If you have, say, a Windows in German, then it is expected that all strings by the operating system actually are in German. |
liigo
commented
Jun 24, 2016
tbu-
commented
Jun 25, 2016
Maybe we should rather escape less characters in the |
retep998
commented
Jun 25, 2016
I'd rather disable escaping only for OS error strings specifically, not for all strings. |
tbu-
commented
Jun 25, 2016
@retep998 I believe Python has a good strategy here, and they don't escape most Unicode symbols, except for weird ones like zero-width space (U+200B): Equivalent Rust: Outputs: |
alexcrichton
commented
Jul 19, 2016
Escape fewer Unicode codepoints in `Debug` impl of `str`
Use the same procedure as Python to determine whether a character is
printable, described in [PEP 3138]. In particular, this means that the
following character classes are escaped:
- Cc (Other, Control)
- Cf (Other, Format)
- Cs (Other, Surrogate), even though they can't appear in Rust strings
- Co (Other, Private Use)
- Cn (Other, Not Assigned)
- Zl (Separator, Line)
- Zp (Separator, Paragraph)
- Zs (Separator, Space), except for the ASCII space `' '` `0x20`
This allows for user-friendly inspection of strings that are not
English (e.g. compare `"\u{e9}\u{e8}\u{ea}"` to `"éèê"`).
Fixes#34318.
CC #34422.
[PEP 3138]: https://www.python.org/dev/peps/pep-3138/
Closes#34318