Current location: Hot Scripts Forums » Programming Languages » Perl » How to replace extended Character with character


How to replace extended Character with character

Reply
  #1 (permalink)  
Old 06-08-05, 08:02 PM
luv_suresh luv_suresh is offline
New Member
 
Join Date: Jun 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
How to replace extended Character with character

How to convert the characters below from the special character to the unaccented character - the number next to the special character is the ASCII decimal value of that charatcer:

é 351 to e
è 350 to e
à 340 to a
ç 347 to c
ù 371 to u
ô 364 to o
û 373 to u
â 342 to a
ê 352 to e
ü 374 to u

If any knows pls let me know on suresh_r@gillette.com or suresh1.r@tcs.com
Reply With Quote
  #2 (permalink)  
Old 06-22-05, 12:16 AM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
I would just use a regex:

Code:
#!/usr/bin/perl
use strict;
use warnings;

my $string = 'é è à ç ù ô û â ê ü';

print $string . "\n";
$string =~ s/\351|\350|\352/e/g;
$string =~ s/\340|\342/a/g;
$string =~ s/\371|\373|\374/u/g;
$string =~ s/\364/0/g;
$string =~ s/\347/c/g;
print $string . "\n";
I'm sure there's some Unicode or UTF-8 module out there that could help though.

~Charlie
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
replace not working.... Mister B. PHP 12 11-07-04 01:41 PM
mySQL REPLACE tinhdangdo PHP 3 08-19-04 04:31 AM
replace pattern-problm with pointers Erev0s C/C++ 0 05-25-04 02:30 AM
Filtering extended ASCII characters xgab Perl 4 05-23-04 08:13 AM


All times are GMT -5. The time now is 04:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.