Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

special character printing issue

by mitchreward (Acolyte)
on Aug 12, 2014 at 07:03 UTC ( [id://1097076]=perlquestion: print w/replies, xml ) Need Help??

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

Hi,

I run a bash script inside perl. The output of the bash script sometime has special charaters: é è à ê ...

When i print my variable containing this return,the output is truncated. Any idea ? Is this a perl issue ?

here is an extract

my $smtpban = `smtpban -s $email | tail -n +20`; my $out = $cerb->post($base . "tickets/$id/comment.xml", [ [ 'comment', "this is an automatic comment \n\n $b +an_msg \n\n banvhost -c \n $banvhost \n\n\n smtpban -s \n\n $smtpban" + ], ]);

Replies are listed 'Best First'.
Re: special character printing issue
by choroba (Cardinal) on Aug 12, 2014 at 07:10 UTC
    Maybe you need Encode?
    use Encode qw{ decode }; my $smtpban = decode('utf-8', qx{ smtpban -s $mail | tail -n +20 });
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: special character printing issue
by Anonymous Monk on Aug 12, 2014 at 07:06 UTC
Re: special character printing issue
by Laurent_R (Canon) on Aug 12, 2014 at 07:12 UTC
    Hmm, difficult to say with so few details, but you may want to take a look at the encode and decode functions of the Encode module. Please show the output of your bash script (without Perl) and of your Perl script.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1097076]
Approved by Ratazong
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2025-07-12 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.