my program doesn't work with these symbols like ą,č,ę,ė,€ and etc. What should I write on this code that it started to work with all the symbols? I can`t find it out with similar topics in Forum. Could someone give me a tip?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Unicode {
public static void main(String[] args) {
InputStreamReader inputStreamReader = new InputStreamReader(System.in);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
try {
String line = null;
while ((line = bufferedReader.readLine()).length() > 0) {
for (int index = 0; index < line.length(); index++) {
String hexCode = Integer.toHexString(line.codePointAt(index)).toUpperCase();
String hexCodeWithAllLeadingZeros = "0000" + hexCode;
String hexCodeWithLeadingZeros = hexCodeWithAllLeadingZeros.substring(hexCodeWithAllLeadingZeros.length()-4);
String a = "U+" + hexCodeWithLeadingZeros;
System.out.println("Unicode: "+a);
String b = line;
byte[] xxx = b.getBytes("UTF-8");
for (byte x : xxx) {
System.out.print(Integer.toHexString(x & 0xFF).toUpperCase()+" ");
}
System.out.println();
System.out.println();
}
}
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
It gives me this: Unicode: U+FFFD EF BF BD