title: How can i get user input in UTF-8?
body: <p>I need user input from cmd/terminal and I want it to be encoded in UTF-8. The problem is everything i tried does not seem to work including a lot of things i found on Stackoverflow.</p>
  
  <p>I tried using Scanner class with System.in as input but it didn't work:</p>
  
  <pre><code>Scanner scanIn = new Scanner(System.in, "UTF-8");
  String command= scanIn.nextLine();
  </code></pre>
  
  <p>I should be getting ČČČ, instead i'm getting ???.</p>
  
  <p>I'm aware that System.in doesn't use UTF-8, and that problem might lie there, however i could use an alternative if there is any.</p>
  
  <pre><code>package utfexample;
  
  import java.io.InputStreamReader;
  import java.io.UnsupportedEncodingException;
  import java.util.Scanner;
  
  
  
  public class UTFExample {
  
  
      public static void main(String[] args) throws UnsupportedEncodingException {
  
          System.out.println("Enter command: ");
  
          Scanner scanIn = new Scanner(new InputStreamReader(System.in, "UTF-8"));
          String command = scanIn.nextLine();
  
  
          System.out.println("command: " + command + "\n");
  
          if(command.equals("Č")){
              System.out.println("Test was successful!");
  
          }
      }
  
  
  }
  </code></pre>