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