Add unicode interpretation; add example for cached VideoCardz feed

This commit is contained in:
2026-01-04 19:42:20 -05:00
parent 8b17888a83
commit 8f145fbdfd
3 changed files with 55 additions and 1 deletions
+16 -1
View File
@@ -72,5 +72,20 @@ func stitchFields(info []string, connectors []string, indices []int8) string {
output.WriteString(info[indices[i]])
}
}
return output.String()
return interpretUnicode(output.String())
}
func interpretUnicode(s string) string {
// match \uXXXX patterns
r := regexp.MustCompile(`\\u([0-9a-fA-F]{4})`)
result := r.ReplaceAllStringFunc(s, func(match string) string {
// extract the hex value
hexStr := match[2:] // skip the \u part
code, err := strconv.ParseInt(hexStr, 16, 32)
if err != nil {
return match // if parsing fails, return original
}
return string(rune(code))
})
return result
}