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.