Make test_rebind.py more robust

  • actually sleep when waiting for tor to log
  • log at debug level when waiting for tor to log
  • backslash-replace bad UTF-8 characters in logs
  • format control commands as ASCII, tor does not accept UTF-8 control commands

Found during legacy/trac#30901 (moved).