#!/usr/bin/perl use strict; use warnings; use utf8; use open ':encoding(utf8)'; my $ofile = 'utf_issue.txt'; open(my $fh,'>', $ofile) or die "Error opening $ofile: $!\n"; binmode($fh, ":utf8"); my $x = 'FREIGHT – INTRASTATE'; print $fh $x, "\n"; print $fh pack('A20',$x), "\n";