refactor has invalid characters into new method

Immaterial change, but allows using `twitter-text` for 3rd-party posts with longer max lengths. I want to check for invalid characters too.