返回 DeepSeek-Reasonix
terminal-text-encoding.md
根目录 / docs / terminal-text-encoding.md
1 # Terminal text encoding / 终端文本编码
2
3 ## Child-process locale / 子进程 locale
4
5 When LANG, LC_ALL and LC_CTYPE are all empty or absent, Reasonix selects an
6 installed UTF-8 locale for child processes. It prefers C.UTF-8, then en_US.UTF-8,
7 then another installed UTF-8 locale. Discovery is bounded and cached per process.
8 If discovery fails or no UTF-8 locale is installed, the environment is retained.
9 Windows continues to use its existing encoding-specific process handling.
10
11 当 LANG、LC_ALL、LC_CTYPE 均为空或未设置时,Reasonix 为子进程选择已安装的 UTF-8
12 locale,优先 C.UTF-8,其次 en_US.UTF-8,再选择其他已安装的 UTF-8 locale。
13 探测有时间限制,并在进程内缓存。探测失败或没有可用 UTF-8 locale 时,保留原环境。
14 Windows 继续使用既有的编码处理。
15
16 Explicit values, including C/POSIX and category overrides, remain unchanged.
17 Reasonix does not change the parent process environment or force LC_ALL. Thus an
18 explicit LC_ALL=C still requests byte-oriented sed/grep/sort semantics.
19
20 用户显式设置的值(包括 C/POSIX 和各分类覆盖)保持不变;不会修改父进程环境或强制
21 设置 LC_ALL。因此显式 LC_ALL=C 仍然要求 sed、grep、sort 等工具使用对应的字节语义。
22
23 ## Interactive input / 交互输入
24
25 Machine-submitted persistent-shell commands use ASCII-only byte escapes. The
26 integrated Bash terminal instead uses a private, temporary Readline configuration:
27 it includes the user's existing inputrc and then enables eight-bit input/output
28 without meta conversion. Other editing preferences remain in place. This accepts
29 Chinese and emoji even with an explicitly selected C locale. The temporary file
30 is removed on launch failure, terminal closure or process exit.
31
32 机器提交给持久 Shell 的命令使用纯 ASCII 字节转义。内置 Bash 终端则使用私有临时
33 Readline 配置:先包含用户原有 inputrc,再开启八位输入输出并关闭 meta 转换,保留
34 其他编辑偏好。这样在显式 C locale 下也能接收中文和 emoji。临时文件会在启动失败、
35 终端关闭或进程退出时清理。
36
37 Long persistent-shell commands are sent as bounded ASCII blocks. Each block
38 must be acknowledged before the next is submitted; only the final step executes
39 the assembled command in the current shell. This avoids canonical terminal
40 input truncation while preserving variables, directory, exit status and stdin
41 isolation. Cancellation during staging retires the shell without executing the
42 partial command.
43
44 较长的持久 Shell 命令会拆成有长度上限的 ASCII 块,每块确认接收后才发送下一块,
45 最后在当前 Shell 中执行完整命令。这样可避免终端规范模式截断输入,同时保留变量、
46 工作目录、退出码与标准输入隔离。分块传输期间取消操作会关闭该 Shell,不执行未完整
47 传输的命令。
48
49 ## Tool output / 工具输出
50
51 Shared live output buffers incomplete UTF-8 characters across reads before
52 emitting JSON events. Completion and cancellation flush an unfinished character
53 as one replacement character. Progress limits and retained output head/tail stop
54 at character boundaries; byte budgets are not increased. Durable protocol fields,
55 tool schemas and model prompt prefixes are unchanged.
56
57 共享实时输出层会缓存跨读取的不完整 UTF-8 字符,完整后才发送 JSON 事件。正常结束和
58 取消时,未完成字符以一个替代字符收尾。进度限额及最终保留的头尾内容都在字符边界
59 截断,不提高字节预算。持久协议字段、工具定义和模型提示前缀保持不变。
60
60 lines MARKDOWN