Using Perl, i'm trying to lowercase words with accents and special chars with lc()
but i can't.
For example:
É UM MAÇO
returns
É um maÇo
-bash$ perl -we 'use utf8; binmode STDOUT, ":utf8"; print lc "É UM MAÇO"'
é um maço
utf8
indicates your program text is unicode. binmode
ensures proper output of wide characters.
You can also use Encode;
, see the docs.
Try adding
use locale;
into your script. It should make various functions including lc
work with accents. Full testing script:
use strict; use warnings;
use locale;
use utf8;
print lc('É UM MAÇO'); # gives "é um maço"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With