winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

YAML with UTF-8 BOM are not handled correctly

Open chbwien opened this issue 8 months ago • 4 comments

Brief description of your issue

If you use YAMLs for the manifest and use UTF-8 with BOM, the first line is completely ignored. The first line usually holds the schema header. This might be a problem for a long time, but headers are checked now and if you use UTF-8 with BOM, the checks will fail. Currently UTF-8 with BOM only works, if you place the schema header in the second line, leaving the first line blank. Or using UTF-8 without BOM.

Steps to reproduce

Use a YAML with UTF-8 with BOM, place the schema-header in the first line and run the validate

Expected behavior

The obe described usage should work

Actual behavior

The first line is ignored

Environment

Windows-Paket-Manager (Vorschau) v1.11.320-preview
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Windows: Windows.Desktop v10.0.26100.4061
Systemarchitektur: X64
Paket: Microsoft.DesktopAppInstaller v1.26.320.0

The current azure tests will fail also!

chbwien avatar Jun 02 '25 12:06 chbwien

Can you provide an example of what you're expecting to work?

denelon avatar Jun 02 '25 14:06 denelon

Unfortunately YAML is not an allowed file type. But you can have a look on \manifests\t\TUitTUWien\TUtoolbox\2025.1.0.707\TUitTUWien.TUtoolbox.installer.yaml Or is there another way to upload a file? To upgrade to our current version I needed to save the manifest without BOM and the schema header was recognized. So this is working: \manifests\t\TUitTUWien\TUtoolbox\2025.1.0.711\TUitTUWien.TUtoolbox.installer.yaml

chbwien avatar Jun 02 '25 14:06 chbwien

If you use a tool such as YamlCreate, WinGet Create, or Komac, the files will be output in the correct format and will not have the BOM

Trenly avatar Jun 02 '25 20:06 Trenly

Alternatively, you can save it without BOM using any editor. However, this is still a bug in Winget. The BOM may never lead to the first line being ignored.

chbwien avatar Jun 03 '25 05:06 chbwien

YAML intrinsically supports UTF-8. I don't see any reason to do extra work to support a BOM when it isn't required.

denelon avatar Jul 08 '25 19:07 denelon

Thanks @Trenly!

denelon avatar Jul 10 '25 23:07 denelon

The less BOMs there are in the ecosystem the better. Better to enforce a strict UTF-8 without BOM everywhere. Seeing more and more people move away from BOM as it's weird and causes issues and the problem it tried to fix really doesn't exist anymore with modern editors and programs.

Frulfump avatar Jul 25 '25 06:07 Frulfump