Sanitize more input to classes to prevent txsockjs breaking things when it inputs unicode instead of str

txsockjs needs to sort itself out.