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);