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

Java terminal app doesn't scan Cyrillic script. #11168

Closed
saiayn opened this issue Sep 7, 2021 · 6 comments
Closed

Java terminal app doesn't scan Cyrillic script. #11168

saiayn opened this issue Sep 7, 2021 · 6 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@saiayn
Copy link

saiayn commented Sep 7, 2021

Windows Terminal version (or Windows build number)

Windows Terminal Version: 1.9.1942.0

Other Software

  • Visual Studio Code Version: 1.60.0
  • OS Version: Windows 10 Pro 10.0.19043 Build 19043
  • Debugger for Java Version: 0.35.0
  • Visual Studio Code Encoding: UTF-8
  • Windows Encoding: UTF-8

Steps to reproduce

  1. Copy and paste the following code.
    import java.util.Scanner;
    class App {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    String wordCyrillic = input.nextLine();//!Привет
    String wordLatin = input.nextLine(); //!hello
    System.out.println("we print: " + wordCyrillic);
    System.out.println("we print: " + wordLatin);
    System.out.println("we print: " + "\u26a1\u2661");
    System.out.println("we print: " + "Привет");
    }
    }
  2. Run this code, inputting commented data(or use random Cyrillic letters).
  3. You will get such output:
    Screenshot (22)

Expected Behavior

I expect it to scan the Cyrillic script properly as the Ubuntu terminal does.
Screenshot (23)

Actual Behavior

Terminal doesn't scan the Cyrillic script at all.

@saiayn saiayn changed the title Java terminal apps doesn't scan Cyrillic script. Java terminal app doesn't scan Cyrillic script. Sep 7, 2021
@DHowett
Copy link
Member

DHowett commented Sep 7, 2021

This looks like a problem in the Windows version of Java? Your screenshots illustrate that the Console and Terminal are properly passing input to Java when it is running under WSL (so: Linux java works fine! 😄)... so it seems like this is a "Java on Windows" bug.

You may need to file this upstream with them.

@saiayn
Copy link
Author

saiayn commented Sep 7, 2021

so: Linux java works fine! 😄)... so it seems like this is a "Java on Windows" bug.

You may need to file this upstream with them.

Thanks for the quick reply, I can assume it's just a Java bug, but it does work fine in Eclipse/IntelliJ terminal.

By the way, as you can see on screenshot n.2 it doesn't really work correctly under WSL Ubuntu.
(Has some problems on "we print: " line n.2)

Screenshot (25)

@ianjoneill
Copy link
Contributor

I think this is probably related to / the same as #4551.

See a screenshot of it working below if you echo the Cyrillic text and then pipe it into the Java process (I removed the reading of the Latin string for ease of demo).

image

Source:

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Scanner;

public class App {

  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    String wordCyrillic = input.nextLine();//!Привет
    System.out.println("we print: " + wordCyrillic);
    System.out.println("Expected bytes " + Arrays.toString("!Привет ".getBytes(StandardCharsets.UTF_8)));
    System.out.println("Got bytes " + Arrays.toString(wordCyrillic.getBytes(StandardCharsets.UTF_8)));
    System.out.println("we print: " + "\u26a1\u2661");
    System.out.println("we print: " + "Привет");
  }
}

@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Sep 7, 2021
@zadjii-msft zadjii-msft added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Sep 8, 2021
@DHowett
Copy link
Member

DHowett commented Sep 16, 2021

Thanks for all the comprehensive investigating! 😄 I'm going to call this a /dupe of #4551.

@ghost
Copy link

ghost commented Sep 16, 2021

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Sep 16, 2021
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Sep 16, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

4 participants