Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ksy file with beginning BOM character fails to compile using kaitai-struct-compiler #499

Closed
bibekdw opened this issue Dec 17, 2018 · 3 comments
Assignees
Milestone

Comments

@bibekdw
Copy link

bibekdw commented Dec 17, 2018

Kaitai-struct-compiler throws error "/meta: unknown key found, expected: doc, doc-ref, enums, instances, meta, params, seq, types" for the ksy file if it has BOM char at the beginning (UTF-8 BOM). As a work around I manually changed the file encoding to UTF-8 and it works.

OS - windows 7 Professional
kaitai-struct-compiler 0.8
JDK 10

@GreyCat GreyCat added this to the v0.9 milestone Dec 17, 2018
@GreyCat
Copy link
Member

GreyCat commented Dec 17, 2018

It turns out that our usage of FileReader for opening YAML files in Java triggers use of system locale. If it's UTF-8, Java can handle (=skip) BOM properly (NB: don't trust this), but if locale is not Unicode-aware (and on Windows, it seems to be always something non-UTF8), this leads to this problem.

On Linux/Mac, a simple way to reproduce this is to run ksc as LC_ALL=C ksc ..., which typically leads to:

/???meta: unknown key found, expected: doc, doc-ref, enums, instances, meta, params, seq, types

A fix to always force use of UTF8 stream is incoming.

@GreyCat
Copy link
Member

GreyCat commented Dec 17, 2018

Should be fixed with kaitai-io/kaitai_struct_compiler@42cb8e4.

@GreyCat GreyCat self-assigned this Dec 17, 2018
@GreyCat
Copy link
Member

GreyCat commented Dec 27, 2018

No reply for 10 days, works for me => closing. Please feel free to reopen if you still observe the problem.

@GreyCat GreyCat closed this as completed Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants