Configuration icon indicating copy to clipboard operation
Configuration copied to clipboard

Update-Metdata should not change file encoding

Open lipkau opened this issue 7 years ago • 2 comments

Current behavior

Metadata is hardcoded to use -Encoding UTF8. UTF8 is UTF-8 with BOM.

https://github.com/PoshCode/Configuration/blob/244a7cbc6f7f415fb989acb82637d42b46447099/Source/Metadata.psm1#L595

Expected behavior

Metadata should not change the file encoding of the manifest.

Eg: I have my manifest files in UTF-8 without BOM

lipkau avatar May 01 '18 13:05 lipkau

Not sure I agree, in principle. I rather think the Metadata module should force UTF8 without BOM (but that wasn't an option on Set-Content at the time, so I settled for UTF8).

Having said that -- for this one command, I agree that it shouldn't mess with the encoding if it's possible to avoid doing so.

Jaykul avatar May 01 '18 14:05 Jaykul

Suggestion

  • use a logic like this to determine if the manifest had BOM before
  • use a logic like this to be able to write without BOM

lipkau avatar May 01 '18 14:05 lipkau