SunnyX
asked on
java. non-English characters encoding problem. intellij idea
package com ;
import java.io.UnsupportedEncodingException;
/**
*/
public class NewHW {
public static void main(String[] args) throws UnsupportedEncodingException {
System.out.println( System.setProperty("file.encoding", "cp-1252") );
String s1 = "Përshëndetje botë!";
byte[] bytes = s1.getBytes("utf-8");
String s2 = new String(bytes, "cp1252");
System.out.println(s2);
}
}
EXPECTED output: Përshëndetje botë!
Actual output: Përshëndetje botë!
Tried to get output in Albanian Hello World. However, the code above doesn't give me expected output. Please tell how should I change my code to meet my expectation.
I use windows 10.
Thanks in advance !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:)
ASKER