http://www.perlmonks.org?node_id=1210792

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone,

I'm using the module PDF::API2 to try and print some non-ascii characters from a web page. I have a web form where I copy and paste non-ascii characters into an input field. When I look at the submitted input using Dumper, I see numeric codes like these:

$VAR1 = 'ω ∞'; And my pdf generation code: sub create { # $sometext is the submitted input from a webpage my $sometext = shift; my $pdf = PDF::API2->new(); my $fonts = { Helvetica => { Bold=>$pdf->corefont('Helvetica-Bold',-encoding=>'latin1'), Roman=>$pdf->corefont('Helvetica',-encoding=>'latin1'), Italic=>$pdf->corefont('Helvetica-Oblique',-encoding=>'latin1'), }, }; my $page = $pdf->page(); my $text = $page->text(); $text->font($fonts->{'Helvetica'}->{Roman}, 20); $text->translate(50, 700); $text->text($sometext); $pdf->saveas('test.pdf'); }

How do I print these as actual non-ascii characters (ω ∞) in the pdf output? Do I need to convert them first? What about "use utf8"? Do I need that line?

Please help :)))