use utf8; use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/html; charset=utf-8\n\n"; open(FILE, "<", "/path/to/utf8/file.txt") || die "$!"; print "
\n";
  while() {
    chomp;
    $_ = set_utf($_);
    my $len = length($_);    # count of chars not bytes
    print "$_", ' ' x (72 - $len), "|\n";
  }
  print "
\n"; sub set_utf { return pack "U0a*", join '', @_; }