Skip to content

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

Closed
@generalmimon

Description

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.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions