I have a couple of powershell automation scripts I wrote that sometimes require editing files used by linux OS family.
I know that windows ends strings in files using the
LF flags, while linux uses only the
Both also use different versions of
While windows is able to read linux-written files, the opposite is not the same, and this actually causes problems when reading windows-written files in linux.
Yet it seems there's more to it: I discovered windows uses
utf8BOM, and actually does not fully support natively the simple
utf8 encoding compared to linux.
My question is this: When using the
set-content cmdlet, the default encoding used by powershell is
utf8NoBOM. What is the actual difference between
utf8NoBOM when using the
-Encoding parameter when writing to files?
Specifies the type of encoding for the target file. The default value is
- utf8: Encodes in UTF-8 format.
- utf8BOM: Encodes in UTF-8 format with Byte Order Mark (BOM)
- utf8NoBOM: Encodes in UTF-8 format without Byte Order Mark (BOM)