I'm trying to translate strings into Slovakian alphabet (8859-2 encoding) via a matching table I created. Problem is some characters do not actually change and the output string shows me "?" for some slovakian character.
How do I do that? I did something like this first :
File tempFile = File.createTempFile("buffer", ".tmp");
FileWriter fw = new FileWriter(tempFile);
Reader fr = new FileReader(fileOriginal);
BufferedReader br = new BufferedReader(fr);
while (br.ready()) {
fw.write(br.readLine().replace("#/e#" , "ě").replace("#>E#" , "É")
}
but some Characters are not correctly replaced.
For example, in this String : "allo #>e# de #>E#" (just an example), it should give me "allo ě de É" but it gives me "allo ? de ?" because UTF-8 doesn't recognize these characters. What do I need to do for my java program to recognize it ?
Thanks in advance.
Does something like this should works for you?
This code reads a file content encoded in UTF-8 and writes by encoding in 8859-2.