When writing the string ‘¿’ out using
System.out.println(new String('¿'.getBytes('UTF-8')));
¿ is written instead of just ¿.
WHY? And how do we fix it?
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.
You don’t have to use UTF-16 to solve this:
works just fine. As long as the encoding given to the
getBytes()method is the same as the encoding you pass to the String constructor, you should be fine!