I'm trying to write ISO8859_8->UNICODE->ISO8859_8 translator (the simplest as possible), but application doesn't seem to work properly. Can you people, please, help me out?
run: (input and output)
Code:
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String text = in.readLine();
PrintStream out = new PrintStream(System.out, true, "UnicodeLittleUnmarked");
out.println( En_De_CODE.encode(text) );
}
}
class En_De_CODE {
public static String encode(String s) throws UnsupportedEncodingException {
// s = "איליה"; // ISO8859_8
return new String(s.getBytes("UnicodeLittleUnmarked")); // to Unicode Little Endian
}
public static String decode(String s) throws UnsupportedEncodingException {
// s = "Ilja";
return new String(s.getBytes("ISO8859_8")); // to Latin/Hebrew
}
}
איליה
? ? ? ? ?
? ? ? ? ?