Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/System.Management.Automation/DscSupport/CimDSCParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,17 @@ internal static byte[] GetFileContent(string fullFilePath)
internal List<CimClass> ParseSchemaMofFileBuffer(string mof)
{
uint offset = 0;
var buffer = Encoding.Unicode.GetBytes(mof);
#if UNIX
// OMI only supports UTF-8 without BOM
var encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);
#else
// This is what we traditionally use with Windows
// DSC asked to keep it UTF-32 for Windows
var encoding = new UnicodeEncoding();
#endif

var buffer = encoding.GetBytes(mof);

var result = new List<CimClass>(_deserializer.DeserializeClasses(buffer, ref offset, null, null, null, _onClassNeeded, null));
return result;
}
Expand Down