Skip to content

Add ability to specify whether UTF8 files have a BOM or not #56

@mkht

Description

@mkht

Description

There are two types of UTF-8 text files, those with BOM and those without, and both are correct UTF-8.
Unfortunately, on some systems, the presence or absence of the BOM can have a serious impact on the behavior, so it must be handled strictly.

There is no way to specify this in the current implementation of FileContentDsc, and even worse, it behaves differently depending on the PowerShell version running the resource.
(In v5.1 and earlier, the BOM is attached, but in v6 and later, it is not.)

Proposed properties

I suggest adding "UTF8BOM" and "UTF8NoBOM" to the acceptable values for Encoding parameter.

Special considerations or limitations

It would be better not to change the existing "UTF8" behavior to avoid serious breaking changes.

This change will only affects the KeyValuePairFile and ReplaceText, not the IniSettingsFile. This is because it does not have an Encoding parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue is an enhancement request.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions