I am trying to read some data via the Console and write that on to a file. I am getting problems when the data from the console has umlaut characters. It prints out '?' instead of umlaut characters . Please find below my code for the same. Can someone please help me
       String cmd = "cmd /C si viewproject"+ cmdLine+" --recurse --fields=indent,name --project="+name;
        Process p = Runtime.getRuntime().exec(cmd);
        BufferedReader in = new BufferedReader(new InputStreamReader(
                p.getInputStream()));
        String line = null;
        File filename = new File(System.getProperty("java.io.tmpdir"),
                "Project" + ".tmp");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(filename), Charset.forName("UTF-8").newEncoder());
        while ((line = in.readLine()) != null) {
            osw.write(line);
            osw.write("\n");
        }
        osw.close();
 
     
    