From 7e65744ef2705b7021f5228dd708b32d39e3d898 Mon Sep 17 00:00:00 2001 From: lkqm Date: Fri, 7 Jan 2022 21:03:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B9=B1=E7=A0=81=E5=B9=B6=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ClipboardExportImportSettingsServiceImpl.java | 2 +- .../service/impl/LocalFileExportImportSettingsServiceImpl.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sjhy/plugin/service/impl/ClipboardExportImportSettingsServiceImpl.java b/src/main/java/com/sjhy/plugin/service/impl/ClipboardExportImportSettingsServiceImpl.java index d45ad45..5606b81 100644 --- a/src/main/java/com/sjhy/plugin/service/impl/ClipboardExportImportSettingsServiceImpl.java +++ b/src/main/java/com/sjhy/plugin/service/impl/ClipboardExportImportSettingsServiceImpl.java @@ -25,7 +25,7 @@ public class ClipboardExportImportSettingsServiceImpl implements ExportImportSet */ @Override public void exportConfig(SettingsStorageDTO settingsStorage) { - String json = JSON.toJson(settingsStorage); + String json = JSON.toJsonByFormat(settingsStorage); CopyPasteManager.getInstance().setContents(new TextTransferable(json)); Messages.showInfoMessage("Config info success write to clipboard!", GlobalDict.TITLE_INFO); } diff --git a/src/main/java/com/sjhy/plugin/service/impl/LocalFileExportImportSettingsServiceImpl.java b/src/main/java/com/sjhy/plugin/service/impl/LocalFileExportImportSettingsServiceImpl.java index 076dcd9..cd72306 100644 --- a/src/main/java/com/sjhy/plugin/service/impl/LocalFileExportImportSettingsServiceImpl.java +++ b/src/main/java/com/sjhy/plugin/service/impl/LocalFileExportImportSettingsServiceImpl.java @@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; /** * 本地文件导入导出设置服务实现 @@ -52,7 +53,7 @@ public class LocalFileExportImportSettingsServiceImpl implements ExportImportSet FileUtil.createIfDoesntExist(file); WriteCommandAction.runWriteCommandAction(ProjectUtils.getCurrProject(), () -> { try { - byte[] bytes = JSON.toJson(settingsStorage).getBytes(); + byte[] bytes = JSON.toJsonByFormat(settingsStorage).getBytes(StandardCharsets.UTF_8); VirtualFile virtualFile = VfsUtil.findFileByIoFile(file, true); if (virtualFile != null) { virtualFile.setBinaryContent(bytes);