I am programatically creating taxonomy terms from a JSON object. I have a simple script that iterates over the converted JSON, and creates a taxonomy hierarchy. Since these terms come from a client-generated CSV they have random spaces and characters in them I want to sanitize/normalize them before I add them using taxonomy_vocabulary_save()
I've looked at the list of drupal Sanitization Functions, but those all seem to deal with HTML/JS strings. Is there a drupal way for me to format these strings, or should I just use a PHP regex to do it?