Re: replace chars
- From: orasnita@xxxxxxxxx (Octavian Rasnita)
- Date: Thu, 27 Dec 2007 18:46:26 +0200
From: "Gunnar Hjalmarsson" <noreply@xxxxxxxxx>
This is the approach I had in mind:
$ cat test.pl
#!/usr/bin/perl
use Encode;
$octets = <DATA>;
$chars = decode 'utf8', $octets;
%special = ( "\xc3\x96" => 'O', "\xc3\xa5" => 'a' );
($translated = $octets) =~ s/(\xc3\x96|\xc3\xa5)/$special{$1}/g;
printf '%-28s%s', 'Raw data (utf8 encoded): ', $octets;
printf '%-28s%s', 'Readable characters: ', $chars;
printf '%-28s%s', 'Translated characters: ', $translated;
I am thinking to do something like:
$text =~ tr/oiaeuüäéö¦EÁëÍÚÝÖíµcÉeçôËÄúÓßCýuonÜóáeEÔOyg»r§a«NÇdRrNEškCuUUDsnAOnc/oiaeuuaeo|EAeIUYOiueEicoEAuOBEyuooUoaeIOOyg>aSa<OCiAoNEskCuUUISnAOnc/;
....because it requires less code.
Octavian
.
- Follow-Ups:
- Re: replace chars
- From: Yitzle
- Re: replace chars
- References:
- replace chars
- From: Octavian Rasnita
- Re: replace chars
- From: Tom Phoenix
- Re: replace chars
- From: Gunnar Hjalmarsson
- Re: replace chars
- From: Octavian Rasnita
- Re: replace chars
- From: Gunnar Hjalmarsson
- Re: replace chars
- From: Chas. Owens
- Re: replace chars
- From: Gunnar Hjalmarsson
- replace chars
- Prev by Date: RE: beginners-help@perl.org
- Next by Date: Re: replace chars
- Previous by thread: Re: replace chars
- Next by thread: Re: replace chars
- Index(es):