Q:

Java won't accept Unicode characters as user input

I'm making an encryption software, and so far everything is great. You enter your message and my software selects 26 unicode characters in order from a random spot in the unicode table and switches each letter with its cooresponding unicode character. The problem is, however, that when I paste the encoded message (unicode characters) into the console, Java spits back different characters each time.
The following code yields this as a result:
Scanner sc = new Scanner(System.in);
String msg = sc.next();
System.out.println(msg);

ⶫⶭ (entered to equal msg)
â¶«â¶­ (given back by Java in the print statement)

A:

You can set the encoding type that the Scanner should be reading in with
String encoding = "the encoding"; // e.g. UTF-8 etc.
Scanner sc = new Scanner(System.in, encoding);

This should fix your issue. Also, please note that when I tested your code as it was in the question on my machine, it worked properly and displayed ⶫⶭ from the print statement.

