Problem
check_error.go imports html/template and uses it to render localized error messages:
import "html/template"
...
tmpl, err := template.New("error").Parse(getLocalizedErrorMessage(locale, c.Code))
html/template contextually auto-escapes its output for safe embedding in HTML. For a library whose primary consumer is a JSON API error body (CheckErrors.JSON()), this means any error data containing <, >, &, or " — for example a regex pattern or a user-supplied value echoed into an error message via template data — gets corrupted into <, >, &, " in the JSON payload.
Fix
Switch the import to text/template, which performs no such escaping and is the correct choice for plain-text/JSON message rendering.
Problem
check_error.goimportshtml/templateand uses it to render localized error messages:html/templatecontextually auto-escapes its output for safe embedding in HTML. For a library whose primary consumer is a JSON API error body (CheckErrors.JSON()), this means any error data containing<,>,&, or"— for example a regex pattern or a user-supplied value echoed into an error message via template data — gets corrupted into<,>,&,"in the JSON payload.Fix
Switch the import to
text/template, which performs no such escaping and is the correct choice for plain-text/JSON message rendering.