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

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Windows
    • Labels:

      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

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  ethan Ethan Brown
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated: