[2.2] Simplified attribute name sanitisation which maintains UTF8 char integrity.

Fixes #5434