Gossamer Forum
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

Programming and creating plugins and templates
Blog
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.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
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

Programming and creating plugins and templates
Blog