Skip to content

Process front matter of UTF-8 files with BOM doesn't work. #2496

@bbalon

Description

@bbalon

Describe the bug
When processing front matter of UTF-8 with BOM files first --- gets deleted.

Version of yq: 4.45.4
Operating system: linux
Installed via: binary release

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)

Create file with BOM
printf '\xEF\xBB\xBF---\ntitle: Test\n---\n' > test_with_bom.md

Value of file is:

cat test_with_bom.md
---
title: Test
---

yq deleted first line:

$ yq --front-matter=process test_with_bom.md
title: Test
---

Command
The command you ran:

yq --front-matter=process test_with_bom.md

Actual behavior

title: Test
---

Expected behavior

---
title: Test
---

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions