Skip to content

Error parsing input file: Unexpected value #25

@a1rb0rn3

Description

@a1rb0rn3

When creating input files with a normal text editor in Linux and then trying to use your tool with those files doesn't work.
The tool exits with the error: Error parsing input file: Unexpected value: [...some garbage].

The problem is that normal text files get encoded with UTF-8 and your tool expects UTF-16LE encoding for the input files.

Solution:
A solution for the above mentioned issue is to simply convert those files to UTF-16LE.

With iconv:

iconv -f UTF-8 -t UTF-16LE input.txt > output.txt
printf '\xFF\xFE' > bom.txt
cat bom.txt output.txt > final_output.txt

With vim:

vim input.txt
:set bomb
:set fileencoding=utf-16le
:wq! output.txt

Note

The Byte Order Mark (BOM) is not needed for the input file to work as setup_var.efi strips it away anyway. However, without it, displaying the input file in the UEFI shell would be a bit ugly.

Expectations:

I don't know if you want to make your tool compatible with other file encodings, but I would somehow expect this to be mentioned in the documentation somewhere. Maybe this will help other people in future facing the same issue. It took me a while to figure out what was causing the problem :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions