Incremental engine for long horizon agents π Star if you like it!
Rust agentic-data-frameworkaiai-agentschange-data-capturecodebase-intelligencecontext-engineeringdata-engineeringdata-indexingdata-processingetlhelp-wantedindexingknowledge-graphllmlong-horizon-agentpythonragreal-timerustsemantic-search
"""The CLI writes UTF-8 to piped output whatever the locale's encoding."""
from __future__ import annotations
import io
from cocoindex.cli import _utf8_when_piped
def test_piped_output_in_a_legacy_encoding_switches_to_utf8() -> None:
raw = io.BytesIO()
# No newline translation, so the bytes are the same on Windows.
stream = io.TextIOWrapper(raw, encoding="cp1252", newline="\n")
_utf8_when_piped(stream)
stream.write("β Dropped App (target states reverted Β· <0.1s)\n")
stream.flush()
assert (
raw.getvalue().decode("utf-8")
== "β Dropped App (target states reverted Β· <0.1s)\n"
)
def test_utf8_output_is_left_alone() -> None:
stream = io.TextIOWrapper(io.BytesIO(), encoding="UTF8")
_utf8_when_piped(stream)
assert stream.encoding == "UTF8"