my $string; open(my $out, "+<", \$string); binmode $out, ':encoding(UTF-8)'; $page->output($out); close($out); print $string;