Skip to content

UnicodeDecodeError on Windows when SKILL.md contains non-ASCII characters (em dash, arrows, emojis) #518

Description

@tuesandal

Bug

agr sync fails on Windows with a UnicodeDecodeError when any SKILL.md file
contains non-ASCII characters (em dashes, arrows, box-drawing characters, emojis, etc.).

Error

UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 4811: character maps to

The traceback points to skill.pyupdate_skill_md_nameskill_md.read_text().

Root cause

read_text() is called without an explicit encoding parameter. On Windows this
defaults to the system locale encoding (cp1252), which cannot decode UTF-8
multibyte sequences for characters like (U+2014), (U+2192), (U+2705), etc.

Expected behaviour

SKILL.md files are markdown — UTF-8 is the universal standard. read_text() should
be called with encoding="utf-8" (or encoding="utf-8-sig" to also handle BOM).

Workaround

Set PYTHONUTF8=1 before running agr:

PYTHONUTF8=1 agr sync # bash/zsh $env:PYTHONUTF8=1; agr sync # PowerShell

Environment

  • OS: Windows 11
  • System encoding: cp1252
  • agr version: 0.8.4
  • Python: 3.12.10

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