Add information about console output encoding #9753
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.Write
does truncate butConsole.WriteLine
does 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.Out
gets 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.