Fixed print_to_buffer() not ensuring output is UTF-8