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

Nim: encoding: ASCII does not work on Windows #960

Closed
generalmimon opened this issue Apr 7, 2022 · 2 comments
Closed

Nim: encoding: ASCII does not work on Windows #960

generalmimon opened this issue Apr 7, 2022 · 2 comments

Comments

@generalmimon
Copy link
Member

Cc @sealmove

On my machine, the error looks like this:

C:\temp\kaitai_struct\tests\spec\nim\texpr_str_encodings.nim(7) texpr_str_encodings
C:\temp\kaitai_struct\tests\compiled\nim\expr_str_encodings.nim(122) fromFile
C:\temp\kaitai_struct\tests\compiled\nim\expr_str_encodings.nim(50) read
C:\temp\kaitai_struct\runtime\nim\kaitai_struct_nim_runtime.nim(332) encode
C:\Users\pp\.choosenim\toolchains\nim-1.6.4\lib\pure\encodings.nim(505) convert
C:\Users\pp\.choosenim\toolchains\nim-1.6.4\lib\pure\encodings.nim(354) open
Error: unhandled exception: cannot find encoding ASCII [EncodingError]

As I see in encodings.nim:338-355, the encoding is resolved differently on Windows. On non-Windows systems, apparently iconv is used, but on Windows the code uses a winEncodings lookup table for name and the corresponding code page number, and there's no ascii.

@sealmove
Copy link
Member

sealmove commented Apr 8, 2022

Hello @generalmimon. It looks like there is an entry for us-ascii but not for ascii. The issue should be resolved now with e0caf5. Please confirm, cheers.

@generalmimon
Copy link
Member Author

generalmimon commented Apr 9, 2022

@sealmove Thanks for the fix, it works fine except that cmpIgnoreCase returns int, not bool: kaitai-io/kaitai_struct_nim_runtime@a3253fd

This issue is now solved.

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