瀏覽代碼

frontend: Fix character encoding issue during profile import

The directory name string passed into libobs functions needs to be
converted into a 8-bit-based encoding (e.g., UTF-8) to avoid mangling
of characters and encoding issues particularly on Windows systems which
use UTF-16 for file names.
PatTheMav 5 月之前
父節點
當前提交
16216b2e30
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      frontend/widgets/OBSBasic_Profiles.cpp

+ 1 - 1
frontend/widgets/OBSBasic_Profiles.cpp

@@ -554,7 +554,7 @@ void OBSBasic::on_actionImportProfile_triggered()
 
 
 	if (!sourceDirectory.isEmpty() && !sourceDirectory.isNull()) {
 	if (!sourceDirectory.isEmpty() && !sourceDirectory.isNull()) {
 		const std::filesystem::path sourcePath = std::filesystem::u8path(sourceDirectory.toStdString());
 		const std::filesystem::path sourcePath = std::filesystem::u8path(sourceDirectory.toStdString());
-		const std::string directoryName = sourcePath.filename().string();
+		const std::string directoryName = sourcePath.filename().u8string();
 
 
 		if (auto profile = GetProfileByDirectoryName(directoryName)) {
 		if (auto profile = GetProfileByDirectoryName(directoryName)) {
 			OBSMessageBox::warning(this, QTStr("Basic.MainMenu.Profile.Import"),
 			OBSMessageBox::warning(this, QTStr("Basic.MainMenu.Profile.Import"),