Use non-local OS error strings (en-US)#34422
Closed
liigo wants to merge 1 commit intorust-lang:masterfrom
Closed
Conversation
Contributor
|
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
|
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. |
Contributor
Author
Contributor
|
Maybe we should rather escape less characters in the |
Contributor
|
I'd rather disable escaping only for OS error strings specifically, not for all strings. |
Contributor
|
@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: |
Member
bors
added a commit
that referenced
this pull request
Jul 28, 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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34318