title: Export CSV in UTF-8 Java
body: <p>I am trying to export a csv file in UTF-8 encoding so it can include foreign caracters (á é í ó ú) but when I export the file it doesn't work. This is an example of my code: </p>
  
  <p>BufferedWriter bw;</p>
  
  <pre><code>    try {
          bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("./hello.csv"), "UTF-8"));            
          bw.write("decepción,función,torsión");
          bw.flush();
          bw.close();
      } catch (IOException e) {
          e.printStackTrace();
      } finally {
      }
  </code></pre>
  
  <p>If i export it to a txt file it works, if I change the extension to csv it ceases to work.</p>