I'm trying to save a .txt file in the UTF_8 format, but I don't understand where I should add that to my code. Here's what I got.
String fileStringName = userHome + "/wordsearch directory/Puzzle.txt";
File filePath = new File(userHome + "/wordsearch directory/Puzzle.txt");
File dirPath = new File (userHome + "/wordsearch directory");
//new method just made
//make pop up jpane displaying puzzle ID.
boolean filePathExists = false;
if(!filePath.exists())
{
filePathExists = dirPath.mkdirs();
try {
//BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path),"UTF-8"));
writer = new PrintWriter(new BufferedWriter(new FileWriter(fileStringName, true)));
// Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileStringName), "UTF-8"));
} catch (IOException e2) {
writer = null;
e2.printStackTrace();
}
writer.printf(savePuzzle.toString());
writer.printf("\n");
writer.close();