Normalise session names sent to tmux

tmux assigns special meaning to certain characters, in particular
periods and colons, and will behave inconsistently if these are
encountered. This cleans up known problematic characters before tmux
receives the session name.

tmux 1.8 and earlier allow but mistreat these special characters. As of
tmux 1.9, periods are simply illegal. It is unknown if that also
applies to colons. The release notes do not seem to mention this change.

Related issue: http://sourceforge.net/p/tmux/tickets/109/
Merge branch 'fix-tmux-session-name'