Skip to content
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

Add information about console output encoding #9753

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Smaug123
Copy link
Contributor

@Smaug123 Smaug123 commented Mar 20, 2024

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 but Console.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 the Write(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 whether Console.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.

@Smaug123 Smaug123 requested a review from a team as a code owner March 20, 2024 20:57
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 20, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime

Copy link

Learn Build status updates of commit fd68108:

✅ Validation status: passed

File Status Preview URL Details
xml/System/Console.xml ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@@ -4995,8 +5003,9 @@ This method can be used to reacquire the standard output stream after it has bee
<format type="text/markdown"><![CDATA[

## Remarks
If value is `null`, nothing is written to the standard output stream.
The output is encoded according to <xref:System.Console.OutputEncoding%2A>.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Runtime community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant