C
C#10mo ago
Karbust

❔ Process Start with unicode characters

Hello, I'm having issues with the following code to launch process when they are on directories with unicode characters, like, for example, C:\Users\fehmikır\Desktop\test. It works without problems on paths without unicode characters. No error is thrown, the execution is "successful", but the application doesn't open. This also happens when manually running the application within a folder with such characters. Launching the process through Electron using the spawn command also works.
public bool Startup(string applicationName, string commandLine = "", string currentDirectory = "")
{
try
{
Environment.CurrentDirectory = currentDirectory;

ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = applicationName,
Arguments = commandLine,
WorkingDirectory = currentDirectory
};

Process.Start(startInfo);

return true;
}
catch (Exception e)
{
m_logFile.WriteArgs("Error while trying to start process [{0}] with command line [{1}] in directory [{2}]", applicationName, commandLine, currentDirectory);
m_logFile.WriteArgs("Exception: {0}", e);
return false;
}
}
public bool Startup(string applicationName, string commandLine = "", string currentDirectory = "")
{
try
{
Environment.CurrentDirectory = currentDirectory;

ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = applicationName,
Arguments = commandLine,
WorkingDirectory = currentDirectory
};

Process.Start(startInfo);

return true;
}
catch (Exception e)
{
m_logFile.WriteArgs("Error while trying to start process [{0}] with command line [{1}] in directory [{2}]", applicationName, commandLine, currentDirectory);
m_logFile.WriteArgs("Exception: {0}", e);
return false;
}
}
Electron code:
const spawnClient = spawn(`${Main.clientFolderPath}\\${binaryName}`, launchParameters, {
detached: true,
cwd: `${Main.clientFolderPath}\\${clientPath}`,
})
const spawnClient = spawn(`${Main.clientFolderPath}\\${binaryName}`, launchParameters, {
detached: true,
cwd: `${Main.clientFolderPath}\\${clientPath}`,
})
Does anyone have any idea on how to solve this? Thank you
2 Replies
WEIRD FLEX
WEIRD FLEX10mo ago
i guess you could try with the compatible path (for example use dir /x)
Accord
Accord10mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.