Added character filtering for category codes. Allowed characters: alphanumeric, non-latin word characters, underscore and dash. Other symbols are stripped. Fixed #1206.