Add information about console output encoding#9753
Open
Smaug123 wants to merge 2 commits intodotnet:mainfrom
Open
Add information about console output encoding#9753Smaug123 wants to merge 2 commits intodotnet:mainfrom
Smaug123 wants to merge 2 commits intodotnet:mainfrom
Conversation
|
Learn Build status updates of commit fd68108: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Smaug123
commented
Mar 21, 2024
|
|
||
| ## Remarks | ||
| If value is `null`, nothing is written to the standard output stream. | ||
| The output is encoded according to <xref:System.Console.OutputEncoding%2A>. |
Contributor
Author
There was a problem hiding this comment.
(I reordered this to put my comment first, because otherwise there's a syntactic ambiguity about whether my comment is conditioned on the "value is null" from the other comment.)
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.
Summary
Adds information I failed to find earlier today, namely "what is the output encoding".
I also added information about the possibly unintuitive operation of
Write{Line}(char array)when the input contains surrogates. (I claim it is indeed unintuitive, because it surprised me.) I've hedged with "may be truncated"; in my testing,Console.Writedoes truncate butConsole.WriteLinedoes not, but I've tested on only one platform. I have made the rather arbitrary choice not to give the same warning on theWrite(char)overload, because that one's even weirder and I'm much less confident in documenting it: whether you get re-encoded output or not depends on whetherConsole.Outgets flushed in between the write of the two chars in a surrogate pair or not. Of course it's implicitly illegal to write surrogates out at all, but it didn't seem to be documented anywhere obvious that this is so.