Fix unique constraint violation and UnicodeEncodeError in publisher_publish command