platbr has asked for the wisdom of the Perl Monks concerning the following question:
I have a literal string like this:
C\303\263pia de DECLARA\303\207\303\203O
and i need to convert it in:
Cópia de DECLARAÇÃO
How to do it in PERL?
Save me dudes!
=)
SOLVED:
Code:
my $string = 'C\303\263pia de DECLARA\303\207\303\203O';
$string =~ s/\\(0-7+)/chr oct $1/eg;
print "$string\n";
OUTPUT:
Cópia de DECLARAÇÃO
Tks GUYS!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to convert octal non printable chars in a string?
by kennethk (Abbot) on Jun 27, 2013 at 14:47 UTC | |
|
Re: How to convert octal non printable chars in a string? (crosspost)
by LanX (Saint) on Jun 27, 2013 at 14:46 UTC |