title: How to replace double quote with &quot; using replaceAll method
body: <p>I've seen other people ask similar questions to this before and have followed the instructions given to those people, but I still cannot get my code to function correctly.</p>
  
  <pre><code>try {
  
      FileReader fr_p = new FileReader("p.txt");
      BufferedReader in_p = new BufferedReader(fr_p);
  
      String line = in_p.readLine();
  
      for (;;) {
  
          line = line.replaceAll("&amp;","&amp;amp;");
          line = line.replaceAll("&lt;","&amp;lt;");
          line = line.replaceAll("&gt;","&amp;gt;");
          line = line.replaceAll("\"","&amp;quot;");
  
          people.add(line);
          line = in_p.readLine();
          if (line == null) break;
  
      }
  
      in_p.close();
  } catch (FileNotFoundException e) {
  
      System.out.println("File p.txt not found.");
      System.exit(0);
  
  } catch (IOException e) {
  
      System.out.println("Error reading from file.");
      System.exit(0);
  
  }
  </code></pre>
  
  <p>This is the code that I've written to attempt to take each name on a separate line of a text file, and put it into an ArrayList, replacing the special characters with their XML entities. I then write this into an HTML file later on.</p>
  
  <p>The code that I've written does this just fine for the first three characters, but when it reaches the line attempting to change any double quotes to <code>&amp;quot;</code>, it doesn't change them and ends up giving me <code>â€</code> instead of a double quote. I'm not sure what else I should change about my code to get this to work.</p>