Re: replace chars

2007-12-27 Thread yitzle
On Dec 27, 2007 11:46 AM, Octavian Rasnita <[EMAIL PROTECTED]> wrote: > I am thinking to do something like: > ...because it requires less code. > More legible code is usually far more valuable than shorter code.

Re: replace chars

2007-12-27 Thread Octavian Rasnita
From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> This is the approach I had in mind: $ cat test.pl #!/usr/bin/perl use Encode; $octets = ; $chars = decode 'utf8', $octets; %special = ( "\xc3\x96" => 'O', "\xc3\xa5" => 'a' ); ($translated = $octets) =~ s/(\xc3\x96|\xc3\xa5)/$special{$1}/g; prin

Re: replace chars

2007-12-27 Thread Octavian Rasnita
From: "rahed" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ("Octavian Rasnita") writes: I want to replace some special characters with their corresponding Western European chars, for example a with a, â with a, s with s, t with t, î with i and so on. The module Text::Unidecode does exactly what you

Re: replace chars

2007-12-27 Thread rahed
[EMAIL PROTECTED] ("Octavian Rasnita") writes: > I want to replace some special characters with their corresponding > Western European chars, for example a with a, â with a, s with s, t > with t, î with i and so on. The module Text::Unidecode does exactly what you look for. The conversion is not

Re: replace chars

2007-12-27 Thread Octavian Rasnita
From: "Dr.Ruud" <[EMAIL PROTECTED]> "Octavian Rasnita" schreef: I have also seen that length($string) returns the number of bytes of $string, and not the number of chars (if the string contains UTF-8 chars). This tells me that you are taking input from an octet buffer that comes from outside.

Re: replace chars

2007-12-27 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Dec 26, 2007 2:59 PM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: Well, then you'll probably need to identify the utf8 octet sequences that correspond to the special characters you want to see transformed. snip Perl strings are in UTF-8*, but if you want to specify a ch

Re: replace chars

2007-12-26 Thread Dr.Ruud
"Octavian Rasnita" schreef: > I have also seen that length($string) returns the number of bytes of > $string, and not the number of chars (if the string contains UTF-8 > chars). This tells me that you are taking input from an octet buffer that comes from outside. my $octets = <>; my $str

Re: replace chars

2007-12-26 Thread Octavian Rasnita
From: "Chas. Owens" <[EMAIL PROTECTED]> >> I believe the OP will need to identify all the characters he would >> like >> to see converted, and code the conversion rules himself using the >> tr/// >> or s/// operator. > > Yes I think that it might not be any standard transforming algorithm > f

Re: replace chars

2007-12-26 Thread Chas. Owens
On Dec 26, 2007 2:59 PM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > [ Please only quote what's necessary to give context. ] > [ Please don't top-post. ] > > Octavian Rasnita wrote: > > Gunnar Hjalmarsson wrote: > >> I believe the OP will need to identify all the characters he would like > >> t

Re: replace chars

2007-12-26 Thread Gunnar Hjalmarsson
[ Please only quote what's necessary to give context. ] [ Please don't top-post. ] Octavian Rasnita wrote: Gunnar Hjalmarsson wrote: I believe the OP will need to identify all the characters he would like to see converted, and code the conversion rules himself using the tr/// or s/// operator.

Re: replace chars

2007-12-26 Thread Tom Phoenix
On Dec 26, 2007 9:33 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Tom Phoenix wrote: > > You might be able to do what you want with Encode. > > > > http://perldoc.perl.org/Encode.html > > Might he? How? If what he wants is within the abilities of that module, of course. It may be that

Re: replace chars

2007-12-26 Thread Octavian Rasnita
won't have any issues, because the chars are UTF-8. Thanks. Octavian - Original Message - From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> To: Sent: Wednesday, December 26, 2007 7:33 PM Subject: Re: replace chars Tom Phoenix wrote: On Dec 26, 2007 3:05 AM, Octavian

Re: replace chars

2007-12-26 Thread Gunnar Hjalmarsson
Tom Phoenix wrote: On Dec 26, 2007 3:05 AM, Octavian Rasnita <[EMAIL PROTECTED]> wrote: I want to replace some special characters with their corresponding Western European chars, for example a with a, â with a, s with s, t with t, î with i and so on. I thought that all those characters were in

Re: replace chars

2007-12-26 Thread Tom Phoenix
On Dec 26, 2007 3:05 AM, Octavian Rasnita <[EMAIL PROTECTED]> wrote: > I want to replace some special characters with their corresponding Western > European chars, for example a with a, â with a, s with s, t with t, î with i > and so on. > > Could you please recommend a module that can do this? Y

replace chars

2007-12-26 Thread Octavian Rasnita
Hi, I want to replace some special characters with their corresponding Western European chars, for example a with a, â with a, s with s, t with t, î with i and so on. Could you please recommend a module that can do this? I don't know what I need to search on CPAN for and I don't want to do th