-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
display something useful for text/plain output of invalid String #18296
Conversation
Sample output:
|
Good idea. Though it would be even more useful if you could also print the beginning of the string up to the first invalid character. That would make it easier to spot where the problem is (especially in long strings). |
@nalimilan, my thinking was that strings containing invalid UTF-8 are most likely because the user was stuffing arbitrary binary data into a |
(We can always do this for now, and decide later if we need more verbose output to explain where the data stops being valid UTF-8 if that turns out to be useful in practice.) |
One can also frequently get partially invalid strings, e.g. when reading text in the wrong encoding (ISO-8859-* as UTF-8), or with corrupt filenames. It's very useful in that case to know where's the invalid character.
Sure. |
This will get re-revised in the 0.6 release as part of #16107 but for now this is fine. |
) (cherry picked from commit 2b2894c)
Rather than throwing an exception in the REPL when it tries to show a
String
containing invalid UTF-8 data, this displays something useful.