script-publish.py: Allow emulator selection with --term
This means we have to delay ControlCode initialization until the user
has actually selected a terminal. The curses.setupterm() logic also
assumes that the selected terminal doesn't change after the initial
call. For our script, this is a safe assumption. If that assumtion
eventually breaks down, you'll have to cache the last-setup terminal
somewhere, and call setupterm() whenever the current control code's
`.term` doesn't match the cached value.
I also fixed a bug where args.encoding was not being passed to
ScriptServerApp.