fix: 修复Windows终端UTF-8编码问题,恢复emoji字符
根因: System.out使用平台默认编码(CP936/GBK),emoji无法编码显示为?。 修复方案: 1. JVM参数: -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8 -Dfile.encoding=UTF-8 2. 代码层: PrintStream使用StandardCharsets.UTF_8 3. 启动脚本: run.bat添加chcp 65001, run.ps1设置Console编码 同时revert之前的emoji→ASCII替换,恢复原始emoji符号。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Scanner;
|
||||
@@ -52,7 +53,8 @@ public class ReplSession {
|
||||
this.agentLoop = agentLoop;
|
||||
this.toolRegistry = toolRegistry;
|
||||
this.commandRegistry = commandRegistry;
|
||||
this.out = System.out;
|
||||
// 强制使用 UTF-8 编码输出,确保 emoji 等 Unicode 字符在 Windows 终端正常显示
|
||||
this.out = new PrintStream(System.out, true, StandardCharsets.UTF_8);
|
||||
this.toolStatusRenderer = new ToolStatusRenderer(out);
|
||||
this.markdownRenderer = new MarkdownRenderer(out);
|
||||
this.spinner = new SpinnerAnimation(out);
|
||||
|
||||
Reference in New Issue
Block a user