Search code examples
javafileiocharshort

java reads and writes \u05DC as '?'


Java is writing \u05DC or (char)1500 as '?' which is (char)63 or \u003F, and reading it from the file as so too.

What is the charactor for \u05DC, and why doesn't java write it in?

Here is the pseudo code.

public void write() {
    char variable=(char)//some algorithm to figure out the integer, which ends up as 1500...
    file.write(char);
}

Solution

  • \u05DC is the Hebrew letter Lamed (ל).

    You need to use the ISO-8859-8 encoding to write the file

    Try something like

    PrintWriter pw = new PrintWriter("pathToYourFile", "ISO-8859-1");