From 2afa7a6cf9effa17f5fbe1c31f6cd907f3b2827f Mon Sep 17 00:00:00 2001 From: ZhouYongyou <128128010+zhouyongyou@users.noreply.github.com> Date: Wed, 5 Nov 2025 01:05:13 +0800 Subject: [PATCH] fix(decision): correct Unicode regex escaping in reInvisibleRunes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Critical Fix ### Problem - ❌ `regexp.MustCompile(`[\u200B...]`)` (backticks = raw string) - Raw strings don't parse \uXXXX escape sequences in Go - Regex was matching literal text "\u200B" instead of Unicode characters ### Solution - ✅ `regexp.MustCompile("[\u200B...]")` (double quotes = parsed string) - Double quotes properly parse Unicode escape sequences - Now correctly matches U+200B (zero-width space), U+200C, U+200D, U+FEFF ## Impact - Zero-width characters are now properly removed before JSON parsing - Prevents invisible character corruption in AI responses - Fixes potential JSON parsing failures ## Related - Same fix applied to z-dev in commit db7c035 --- decision/engine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decision/engine.go b/decision/engine.go index 7008548e..bcfdbc7c 100644 --- a/decision/engine.go +++ b/decision/engine.go @@ -20,7 +20,7 @@ var ( reJSONArray = regexp.MustCompile(`(?is)\[\s*\{.*?\}\s*\]`) reArrayHead = regexp.MustCompile(`^\[\s*\{`) reArrayOpenSpace = regexp.MustCompile(`^\[\s+\{`) - reInvisibleRunes = regexp.MustCompile(`[\u200B\u200C\u200D\uFEFF]`) + reInvisibleRunes = regexp.MustCompile("[\u200B\u200C\u200D\uFEFF]") ) // PositionInfo 持仓信息