wizard: write key files as UTF-8 (no BOM)

FFileHelper::SaveStringToFile defaults to an encoding Node can't always parse;
force UTF-8 without BOM for auth.env and integrations.json so the gateway reads
them correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-06-24 01:38:05 +03:00
parent 341e694ab5
commit 68c1ca32c0

View File

@ -273,7 +273,8 @@ FReply SMCPWizard::OnSaveElevenLabsKey()
FString Out;
TSharedRef<TJsonWriter<TCHAR, TPrettyJsonPrintPolicy<TCHAR>>> Writer = TJsonWriterFactory<TCHAR, TPrettyJsonPrintPolicy<TCHAR>>::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