Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6447

Allow UTF8 files to have a leading BOM to be more tolerant of files produced on Windows

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Windows
    • Hide

      Files with BOMs should not cause errors when being read

      Show
      Files with BOMs should not cause errors when being read
    • Night's Watch

    Description

      UTF-8 files produced on Windows often contain a BOM. Puppet now reads most files as utf-8, but doesn't allow for them to have a leading BOM.

      This can be a problem for end users on Windows, where they might need to go through workarounds to produce content without a BOM. For instance, PowerShell can write files as UTF-8 with the Out-File cmdlet, specifying -Encoding UTF8 - but the files are written with a BOM, which ends up blowing up Ruby if we try to read the files in Puppet (under certain circumstances).

      An easy solution is to modify any calls specifying utf-8 when opening files for read, to instead specify bom|utf-8. Ruby will handle the BOM correctly in this case.

      Note that the Ruby YAML.load_file API already handles the BOM situation correctly, so YAML files will generally be excluded from this problem.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ethan Ethan Brown
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support