fix(windows): add ensure_utf8_streams() for Windows GBK encoding + ConPTY docs
- Add ensure_utf8_streams() in output.py: reconfigures stdout/stderr to UTF-8 on Windows at CLI startup, fixing emoji UnicodeEncodeError on GBK locales - Call ensure_utf8_streams() in cli() entry point — one-line fix for all output paths (click.echo, rich Console, print) - Add Windows ConPTY troubleshooting to README (English + Chinese): document Git Bash workaround, ConPTY pipe capture issue, and encoding notes Ref: #29 (issuecomment-4065690862)
This commit is contained in:
@@ -61,6 +61,7 @@ from .output import (
|
||||
default_structured_format,
|
||||
emit_error,
|
||||
emit_structured,
|
||||
ensure_utf8_streams,
|
||||
error_payload,
|
||||
structured_output_options,
|
||||
success_payload,
|
||||
@@ -303,6 +304,7 @@ def _run_write_command(
|
||||
def cli(ctx, verbose, compact):
|
||||
# type: (Any, bool, bool) -> None
|
||||
"""twitter — Twitter/X CLI tool 🐦"""
|
||||
ensure_utf8_streams()
|
||||
_setup_logging(verbose)
|
||||
ctx.ensure_object(dict)
|
||||
ctx.obj["compact"] = compact
|
||||
|
||||
Reference in New Issue
Block a user