app: Only allow valid charsets

Charsets must be [-_A-Za-z0-9] only.

https://bugzilla.gnome.org/show_bug.cgi?id=730390
(cherry picked from commit b0bdd4740f82daa6c2bb020738a857b8e8d2a6dd)

Conflicts:
	src/terminal-app.c
Revert "app: Don't change the title on tab labels that no longer exist"

This reverts commit e2824de3fc3696dd14752501f15c484a3b398ff8.