Current Behavior
On the file App.xaml.cs, the RunOnStartup function creates a task in the Windows Task Scheduler via an XML file. The file header suggests that it is encoded in UTF-16.
|
@"<?xml version=""1.0"" encoding=""UTF-16""?> |
But afterwards, the file is created using File.WriteAllText without an encoding specifier, which defaults to UTF-8
|
File.WriteAllText(tempXmlFile, taskXml); |
This is a problem when Path contains a character with different representations in the two encodings, resulting in an invalid task on the scheduler.
Expected Behavior
The task on the Windows Task Scheduler should have the correct path, even if it has special characters.
My guess is that it should be solved when the correct encoding is passed to File.WriteAllText
File.WriteAllText(tempXmlFile, taskXml, Encoding.Unicode);
Steps to Reproduce
- Install the program in a folder that has a special character in the Path (e.g. "C:\Users\User\Utilitários\WinMemoryCleaner.exe")
- Activate the Run on Startup function in the program
- The task on Windows Task Scheduler will have a corrupted path (e.g. "C:\Users\User\Utilitários\WinMemoryCleaner.exe")
App Version
3.0.8
Windows Version
Windows 11
Additional Context
No response
Checklist
Current Behavior
On the file App.xaml.cs, the
RunOnStartupfunction creates a task in the Windows Task Scheduler via an XML file. The file header suggests that it is encoded in UTF-16.WinMemoryCleaner/src/App.xaml.cs
Line 641 in a19f257
But afterwards, the file is created using
File.WriteAllTextwithout an encoding specifier, which defaults to UTF-8WinMemoryCleaner/src/App.xaml.cs
Line 696 in a19f257
This is a problem when
Pathcontains a character with different representations in the two encodings, resulting in an invalid task on the scheduler.Expected Behavior
The task on the Windows Task Scheduler should have the correct path, even if it has special characters.
My guess is that it should be solved when the correct encoding is passed to
File.WriteAllTextFile.WriteAllText(tempXmlFile, taskXml, Encoding.Unicode);Steps to Reproduce
App Version
3.0.8
Windows Version
Windows 11
Additional Context
No response
Checklist