larksuite / larksuite/cli

fix(slides): make IconPark JSON output safe on non-UTF-8 Windows consoles

Open Beginner friendly
#2,479 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug domain/core
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

Environment

  • main at 35bd5ecfcd84c8e457323a1bcf9453ba600c0270
  • Windows/amd64
  • Python 3.13.13
  • A non-UTF-8 stdout encoding such as Windows cp1252

Reproduction

$env:PYTHONIOENCODING = 'cp1252'
python skills/lark-slides/scripts/iconpark_tool.py search --query growth --limit 1

The command exits non-zero with:

UnicodeEncodeError: 'charmap' codec can't encode characters ...

The traceback ends at write_json, where json.dumps(..., ensure_ascii=False) is printed through the locale-dependent stdout stream.

Expected behavior

The command should emit valid JSON and exit successfully regardless of whether the Windows console uses UTF-8. Parsed JSON values should remain unchanged.

Impact

IconPark search and resolution can fail before producing any machine-readable output on common Windows locales because result metadata contains non-ASCII text. In the repository's Python subprocess tests, three CLI cases fail under the default non-UTF-8 Windows encoding for this reason.

Suggested direction

Emit ASCII-safe JSON escapes (or otherwise make the stdout encoding contract explicit and robust), then add a subprocess regression test with a forced non-UTF-8 PYTHONIOENCODING.

Duplicate check

I searched open and closed issues, all PR states, and repository history for IconPark with Windows, Unicode, encoding, and cp1252; no existing report or competing fix was found.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in skills/lark-slides/scripts/iconpark_tool.py at write_json, then run the repository's Python subprocess tests with PYTHONIOENCODING forced to cp1252. Confirm the affected search and resolution CLI cases produce valid JSON without changing parsed values. Done when the regression coverage passes on non-UTF-8 Windows output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.