use Encode qw( encode ); print(encode('UTF-8', $text));