You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
Thanks for detailing the encoding problem, the origin design that assuming UTF-16LE is for recognizing UEFI shell redirected output, and I think adding the whole libiconv or encoding-rs for encoding conversion is a little too much for a UEFI application.
Some other not that important details about the design:
When the read from file feature was originally designed and coded, there was no fs support in uefi-rs, so reading from stdin (piped) is chosen.
UEFI shell will interpret file content as UTF-16, so we must use codec conversion to interprete UTF-8 bytes that are wrongly read as UTF-16.
Reading from file using fs seems to be a better idea, but it increases confusion (if we don't want to add codec conversion), as you must use UTF-8 for file specified in arguments (which will be read using fs api, and intepreted as UTF-8) and use UTF-16 for file specified by feeding into stdin.
I will first fix document to add text encoding information and link to this issue. And see if there will be a better design for handling both UTF-8 and UTF-16LE files.
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
:With
vim
: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
The text was updated successfully, but these errors were encountered: