ZhouYongyou
|
db7c0359f4
|
fix(decision+news): correct Unicode regex escaping & precompile telegram patterns
## Critical Fix: Unicode Regex Escaping
### decision/engine.go
- ❌ WRONG: `regexp.MustCompile(`[\u200B...]`)` (raw string, no escaping)
- ✅ FIXED: `regexp.MustCompile("[\u200B...]")` (double quotes, proper Unicode)
**Impact**: Backticks don't parse \uXXXX escape sequences in Go!
- Raw string: matches literal text "\u200B" (useless)
- Double quotes: matches Unicode characters U+200B, U+200C, U+200D, U+FEFF (correct)
### news/provider/telegram/telegram.go
- Move regex patterns to global precompiled variables
- Eliminates repeated compilation in stripHTML()
## Performance
- Regex compilation: O(n) → O(1)
- stripHTML() now uses precompiled patterns
## Testing
✅ Compilation successful
✅ Unicode characters properly matched
|
2025-11-05 01:02:49 +08:00 |
|