Skip to content

Bug: UnicodeEncodeError in create_provider_plugin.py on Windows (cp1252 console) #518

Description

@jaideepkumar69-tech

Describe the overall issue and situation

On Windows, scripts/create_provider_plugin.py and the test_plugin.py it generates print Unicode checkmarks ( / ). Windows consoles default stdout/stderr to a legacy code page (typically cp1252), so both scripts crash with UnicodeEncodeError before the plugin can be generated or verified.

This is the same root-cause class as #108, #158, and #166 (Windows cp1252 vs Unicode), which were fixed for file I/O / HTML export in io.py. The generator script's console output was not covered.

Related to #158 (6 👍; already-fixed HTML/file I/O case). This issue is the remaining console-output path.

Expected behavior

python scripts/create_provider_plugin.py ... and the generated test_plugin.py print status lines successfully on a default Windows console.

Actual behavior

UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 0: character maps to <undefined>

pytest tests/create_provider_plugin_test.py also fails on Windows because subprocess.run(..., text=True) decodes the generated script's UTF-8 output with the locale encoding, producing mojibake instead of the expected checkmarks.

Steps to reproduce the issue

  1. On Windows, open a default cmd.exe or PowerShell session (code page 1252 / cp1252).
  2. From a clone: python scripts/create_provider_plugin.py --help or run the generator as documented.
  3. Observe UnicodeEncodeError when the script prints a / status line.
  4. Alternatively: pytest tests/create_provider_plugin_test.py — 15 failures on Windows before a UTF-8 stdout/stderr reconfigure.

Any additional content

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