title: Java FileWriter outputs a question mark
body: <p>I have been unable to find the reason for this. The only problem I am having in this code is that when the <code>FileWriter</code> tries to put the new value into the text file, it instead puts a ?. I have no clue why, or even what it means. Here is the code:</p>
  
  <pre><code>if (secMessage[1].equalsIgnoreCase("add")) {
      if (secMessage.length==2) {
          try {
              String deaths = readFile("C:/Users/Samboni/Documents/Stuff For Streaming/deaths.txt", Charset.defaultCharset());
              FileWriter write = new FileWriter("C:/Users/Samboni/Documents/Stuff For Streaming/deaths.txt");
              int comb = Integer.parseInt(deaths) + 1;
              write.write(comb);
              write.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>And here is the readFile method:</p>
  
  <pre><code>static String readFile(String path, Charset encoding) throws IOException {
      byte[] encoded = Files.readAllBytes(Paths.get(path));
      return new String(encoded, encoding);
  }
  </code></pre>
  
  <p>Also, the secMessage array is an array of strings containing the words of an IRC message split into individual words, that way the program can react to the commands on a word-by-word basis.</p>