-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8350703: Add standard system property stdin.encoding #24738
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
Changes from 6 commits
b4e88cf
1089d6f
630d99b
2b9ad4a
d32004b
42933bc
5357e50
c4bf316
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -634,6 +634,7 @@ GetJavaProperties(JNIEnv* env) | |
| LCID userDefaultUILCID = MAKELCID(userDefaultUILang, SORTIDFROMLCID(userDefaultLCID)); | ||
|
|
||
| { | ||
| HANDLE hStdIn; | ||
|
||
| HANDLE hStdOutErr; | ||
|
|
||
| // Windows UI Language selection list only cares "language" | ||
|
|
@@ -677,6 +678,11 @@ GetJavaProperties(JNIEnv* env) | |
| sprops.sun_jnu_encoding = "MS950_HKSCS"; | ||
| } | ||
|
|
||
| hStdIn = GetStdHandle(STD_INPUT_HANDLE); | ||
| if (hStdIn != INVALID_HANDLE_VALUE && | ||
| GetFileType(hStdIn) == FILE_TYPE_CHAR) { | ||
| sprops.stdin_encoding = getConsoleEncoding(FALSE); | ||
| } | ||
| hStdOutErr = GetStdHandle(STD_OUTPUT_HANDLE); | ||
| if (hStdOutErr != INVALID_HANDLE_VALUE && | ||
| GetFileType(hStdOutErr) == FILE_TYPE_CHAR) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could explain about sun* a bit more (just for compatibility) and stdin.encoding is free from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment could be clearer. As I understand it, it's just trying to saying that the legacy sun.stdout.encoding/sun.stderr.encoding properties for stdout/stderr only, no equivalent for stdin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the comment was a bit terse so I tried to clarify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it looks okay now.