Skip to content

minimax-xlsx: scripts crash with UnicodeEncodeError on Windows when output is piped #110

Description

@quickbeard

Summary

Every script in skills/minimax-xlsx/scripts/ prints non-ASCII characters (, , , ). On Windows, Python uses the legacy ANSI codepage (e.g. cp1252) for piped stdout — and piped is how agent shells capture output, and how any scripted/CI invocation runs — so the first such print raises UnicodeEncodeError and the script dies mid-operation.

Real-world failure

Hit during an offline install verification on Windows 10, Python 3.14 (python-3.14.6-amd64.exe, default locale en-US/cp1252):

File "...\minimax-xlsx\scripts\xlsx_pack.py", line 65, in pack
    print("✓ All XML files are well-formed")
File "C:\Program Files\Python314\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 0: character maps to <undefined>

The pack itself had succeeded — the crash is purely in the progress output, but it exits non-zero and aborts whatever invoked it. Note the same crash hits agent runtime use of the skill on Windows, not just installers: agent tools capture script output through pipes.

Reproduction (any OS)

PYTHONIOENCODING=cp1252 python3 skills/minimax-xlsx/scripts/xlsx_pack.py \
  skills/minimax-xlsx/templates/minimal_xlsx /tmp/test.xlsx | cat
# → UnicodeEncodeError: 'charmap' codec can't encode character '\u2713'

Affected (all print non-ASCII): xlsx_pack.py, xlsx_unpack.py, xlsx_reader.py, formula_check.py, xlsx_add_column.py, xlsx_insert_row.py, xlsx_shift_rows.py, shared_strings_builder.py, style_audit.py, libreoffice_recalc.py.

Proposed fix

Reconfigure stdout/stderr with errors="replace" at startup so output degrades to ? instead of crashing — no behavior change on UTF-8 terminals, and the scripts' exit codes / file outputs are untouched. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions