diff --git a/Source/UEBlueprintMCPEditor/Private/SMCPWizard.cpp b/Source/UEBlueprintMCPEditor/Private/SMCPWizard.cpp index 9d8513e..b948a26 100644 --- a/Source/UEBlueprintMCPEditor/Private/SMCPWizard.cpp +++ b/Source/UEBlueprintMCPEditor/Private/SMCPWizard.cpp @@ -273,7 +273,8 @@ FReply SMCPWizard::OnSaveElevenLabsKey() FString Out; TSharedRef>> Writer = TJsonWriterFactory>::Create(&Out); const bool bSer = FJsonSerializer::Serialize(Root.ToSharedRef(), Writer); - const bool bOk = bSer && FFileHelper::SaveStringToFile(Out, *File); + // UTF-8 (no BOM) so Node's JSON.parse can read it back. + const bool bOk = bSer && FFileHelper::SaveStringToFile(Out, *File, FFileHelper::EEncodingOptions::ForceUTF8WithoutBOM); Notify(bOk ? FText::Format(LOCTEXT("ElevenSaved", "Saved to {0}"), FText::FromString(File)) : LOCTEXT("ElevenSaveFail", "Could not write integrations.json"), bOk); @@ -430,7 +431,7 @@ bool SMCPWizard::UpsertEnvVar(const FString& FilePath, const FString& Key, const Lines.Pop(); } const FString Out = FString::Join(Lines, TEXT("\n")) + TEXT("\n"); - return FFileHelper::SaveStringToFile(Out, *FilePath); + return FFileHelper::SaveStringToFile(Out, *FilePath, FFileHelper::EEncodingOptions::ForceUTF8WithoutBOM); } #undef LOCTEXT_NAMESPACE