mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-03 11:00:58 +08:00
fix(decision): correct Unicode regex escaping in reInvisibleRunes
## 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
This commit is contained in:
@@ -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 持仓信息
|
||||
|
||||
Reference in New Issue
Block a user