AI article

Why your Python tool corrupts text on Windows, and why chcp 65001 doesn't fix it

Community description: I lost an afternoon to a config file last week. The graph name was right there in the JSON, spelled...

Dev.to | Sep 12, 2026 | MilkyWay008

Automated excerpt

Both are one thing: Python's default text encoding on Windows is not UTF-8. That's UTF-8 mode (PEP 540, available since 3. 7). It makes open() default to UTF-8, switches the filesystem encoding to UTF-8, and, the part that matters here, makes locale. getpreferredencoding() return utf-8 so pipe decoding gets the right codec.

Selected automatically from source text; not independently written or fact-checked. Read the original for full context.

Read the original article

More AI news