8166535: jshell tool: cannot handle non-ascii characters
authorjlahoda
Mon, 30 Jan 2017 13:14:09 +0100
changeset 43333 958f1fb2dfd6
parent 43332 88688213d2e3
child 43334 c5fb77a8b62a
8166535: jshell tool: cannot handle non-ascii characters Summary: Using a more appropriate native method to read from the console. Reviewed-by: rfield
jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp
--- a/jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp	Mon Jan 30 09:09:34 2017 +0100
+++ b/jdk/src/jdk.internal.le/windows/native/lible/WindowsTerminal.cpp	Mon Jan 30 13:14:09 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
     INPUT_RECORD record;
     DWORD n;
     while (TRUE) {
-        if (ReadConsoleInput(hStdIn, &record, 1, &n) == 0) {
+        if (ReadConsoleInputW(hStdIn, &record, 1, &n) == 0) {
             return NULL;
         }
         if (record.EventType == KEY_EVENT) {
@@ -97,7 +97,7 @@
 
 JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getConsoleOutputCodepage
   (JNIEnv *, jobject) {
-    return GetConsoleCP();
+    return GetConsoleOutputCP();
 }
 
 JNIEXPORT jint JNICALL Java_jdk_internal_jline_WindowsTerminal_getWindowsTerminalWidth