-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-strArea: str and StringArea: str and StringC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Currently Path
has:
- a single
display()
method which converts any invalid UTF-8 bytes to REPLACEMENT CHARACTER (U+FFFD) - a
Debug
impl that always adds quotes and escapes invalid UTF-8 bytes
This can result in some confusion because people that "just want to print a path" may end up inadvertently producing lossy output.
It would be great to:
- add a
display_escaped()
method which is similar to theDebug
impl if there are invalid UTF-8 bytes, or the currentdisplay()
impl if there aren't. In other words:- if there are invalid UTF-8 byte sequences, it adds quotes and escapes those byte sequences
- if not, then it doesn't add quotes.
- rename
display()
todisplay_lossy()
(and perhaps deprecatedisplay()
in a new Rust edition?)
cc @Manishearth (who requested I file this), @m-ou-se
DianaNitesDianaNitesDianaNitesDianaNitesDianaNites
Metadata
Metadata
Assignees
Labels
A-strArea: str and StringArea: str and StringC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.