How to read international characters from the console

How can I read international characters from the console in java?

+3
source share
3 answers

Using a class java.io.Consolelike any other character. The question is whether the console itself supports these "international characters", but this has nothing to do with Java.

+4
source

- java.io.Console , InputStreamReader System.in, System.in InputStream. InputStreamReader, , Charset, CharsetDecoder.

+2

I can not solve the problem since I am a beginner. I would like to use UTF-8 encoding. If I type "aΓ‘kΓΊ" (or any text with non-English characters), the program will freeze!

    Scanner sc = new Scanner(System.in);
    System.out.println("Please type any text:");
    String text = sc.nextLine();
    System.out.println("");
    System.out.println(text);

The InputSream class does some result, for example, System.in ...

+1
source

Source: https://habr.com/ru/post/1738326/


All Articles