Java – from system In get Unicode value
•
Java
I created one from system In to get the input scanner so that I can get the input from the console
Scanner scanner = new Scanner(system.in,"UTF-8");
When I do
String s = scanner.next();
Then enter in the console Словоדבר, The value of the string becomes
The console can display Unicode characters, but why can't I read them?
Solution
Assume system In is a UTF - 8 encoding that is not secure For workarounds, see this question
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码