Gossamer Forum
Skip to Content



Home : General : Perl Programming :

ucfirst with acute character?

Quote Reply
ucfirst with acute character?
Hi,

I thought it were easy in perl but not. I want the $var="CRÉDIT" to be print out as "Crédit". So I use the command ucfirst(lc($var)); but the result is "CrÉdit".

Is there any settings before the command so that this function can work as expectedly?

Thanks!

Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] ucfirst with acute character? In reply to
Hi,

Just try this;

Code:
my @fields = split /\n/, qq{É é
...more charachters to be changed
É é
É é
É é
É é
É é
..etc
};

foreach (@fields) {
my ($orig,$replace) = split / /, $_;
$var =~ s|\Q$orig|$replace|sig;
}

Unfortunatly, I don't think uc(), lc(), or ucfirst() take into account foreign charachters Frown

Cheers

Andy (mod)
andy@ultranerds.com



Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] ucfirst with acute character? In reply to
Thanks for your reply Andy!

I also tried to use the 'use locale' but that seems not working.
So I have to replace these characters manually as your suggestion.

Cheers,

Cheers,

Dat

Scripts installation and plugin creation
Plugins