Write content to disk as UTF8 in FileSystem #1315
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
The reason why I made this PR is because the launcher file created by :openvs command would result VS not able to find the script file if the file name or path is not in English.
After I dig into the launcher file, the content like below. The file path is the problem.
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31409.214 MinimumVisualStudioVersion = 10.0.40219.1 Project("{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}") = "scriptcs", "C:\tools\scriptcs\Release\scriptcs.exe", "{9F27174A-6008-4476-B5BE-BD6DCE9A0454}" ProjectSection(DebuggerProjectSystem) = preProject PortSupplier = 00000000-0000-0000-0000-000000000000 Executable = C:\tools\scriptcs\Release\scriptcs.exe RemoteMachine = localhost StartingDirectory = C:\workspace\github\code_review\Linked List\**206. å��转链è¡**¨ Arguments = solution.csx -debug -loglevel info Environment = Default LaunchingEngine = 00000000-0000-0000-0000-000000000000 UseLegacyDebugEngines = No LaunchSQLEngine = No AttachLaunchAction = No IORedirection = Auto EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CDD5E630-9123-4BD1-A17C-B35480078326}" ProjectSection(SolutionItems) = preProject ..\..\..\..\..\workspace\github\code_review\Linked List\206. ·´×ªÁ´±í\solution.csx = ..\..\..\..\..\workspace\github\code_review\Linked List\206. ·´×ªÁ´±í\solution.csx EndProjectSection EndProjectThen I find FileSystem.WriteToFile() causing this.
How?
After specifying the encoding to UTF8 in File.WriteAllText() method, then the created content of launcher file is good. And VS loads the script file as expected.