Implement save_tv_as_string to assist in #1176.