fix: use encoding='utf-8' with errors='replace' for bird subprocess calls

Fixes non-UTF-8 character handling in Twitter content.
Replaces text=True with explicit encoding parameters.

Co-authored-by: dev-starlight <dev-starlight@users.noreply.github.com>
Closes #3
This commit is contained in:
Panniantong 2026-02-25 13:44:47 +01:00
parent fe7ed1656b
commit 31eb6db537

View file

@ -60,7 +60,8 @@ class TwitterChannel(Channel):
async def _read_bird(self, url: str, bird: str, config=None) -> ReadResult:
result = subprocess.run(
[bird, "read", url],
capture_output=True, text=True, timeout=30,
capture_output=True, timeout=30,
encoding='utf-8', errors='replace',
env=_bird_env(config),
)
if result.returncode != 0:
@ -147,7 +148,8 @@ class TwitterChannel(Channel):
try:
result = subprocess.run(
[bird, "search", query, "-n", str(limit)],
capture_output=True, text=True, timeout=30,
capture_output=True, timeout=30,
encoding='utf-8', errors='replace',
env=_bird_env(config),
)
if result.returncode != 0: