Handling of illegal characters in tags