I am using the following code
String str="12345";
byte[] b=str.getBytes("UTF-8");
String str1=new String(b,"UTF-8");
System.out.println(str1);
I am getting the following result
=♠4??o;◄EZZ▬▲]
Why is it not giving the original string?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
try to
System.out.println("12345"). If result is the same, that means that you system encoding is not suitable. In this case(if you use cmd) trychcp 65001and retry. Another option is to try to set system property file.encoding=UTF-8 before running ide.