diff --git a/src/main/java/com/bupt/note/Controller/NoteController.java b/src/main/java/com/bupt/note/Controller/NoteController.java index c3b4813..809d83d 100644 --- a/src/main/java/com/bupt/note/Controller/NoteController.java +++ b/src/main/java/com/bupt/note/Controller/NoteController.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -78,7 +79,7 @@ public class NoteController { paperNote.setUserName(username); paperNoteRepository.save(paperNote); } - wr = new FileWriter(f); + wr = new FileWriter(f, StandardCharsets.UTF_8); wr.write(noteForm.getContent()); return ResponseDataUtil.buildSuccess(note); } catch (IOException e) {