From 5a57ac5a715d0c94b70352e7957cae3671031a56 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Mon, 3 Aug 2020 15:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AC=94=E8=AE=B0=E4=B9=B1?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/bupt/note/Controller/NoteController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) {