Posts tagged perl
Posts tagged perl
tr does not support UTF-8 out of the box, neither does Perl.
So what if you consistently want to change the case of text that you are processing?
In contrast to tr, you can talk Perl into properly dealing with all kinds of UTF-8 characters:
echo ‘ÄC/DC Ñ’ | perl “-Mopen qw/:std :utf8/” -pe ‘$_=lc’
gives
äc/dc ñ
And
echo ‘ßčňřšžæøåáéíóúàèìòùâêîôûçşłąęįǫųćśźżãẽĩõũ’ | perl “-Mopen qw/:std :utf8/” -pe ‘$_=uc’
gives
SSČŇŘŠŽÆØÅÁÉÍÓÚÀÈÌÒÙÂÊÎÔÛÇŞŁĄĘĮǪŲĆŚŹŻÃẼĨÕŨ
The first one-liner turns everything into lower case, using Perl’s built-in lc function, while the second one turns everything into upper case, using uc.
Hat tip to user potyl on StackOverflow, who gave a nice answer to the question on how to properly use UTF-8 with the diamond operator. So I only had to transfer the statement
use open qw/:std :utf8/;
to the command line argument
“-Mopen qw/:std :utf8/”
“grep”:
perl -ne ‘print if m/MY_REGEX/’
“grep -v”:
perl -ne ‘print unless m/MY_REGEX/’
“grep -i”:
perl -ne ‘print if m/MY_REGEX/i’
“grep -vi”:
I am sure you know how to do this now ;-)
… thanks to Ahmad Zawawi:

Nothing ground-breaking, but some nice new features in MonoDevelop 2.8.
MonoDevelop is for me one of the IDEs Padre can still learn a lot from …
Quite a thourough review of CPAN modules for spelling out numbers in English.
Interesting piece about the threshold for contributors from different cultures.
Also some good comments, e.g. from Donnie Berkholz:
… the same things important to increasing contribution from high-context cultures are *also* important to recruiting and retaining contributors in low-context cultures. Relationships and integration into the community trumps everything.
I fully agree. The Padre project is doing things the right way here. There is a Code of Conduct and a Diversity Statement, the community is open and welcoming, development is public and transparent, developers are spread around the globe (Germany, Israel, Jordan, Australia, Turkey, the Netherlands, Brazil, France …) and people from the project (in particular Gabor) go to events and talk to people in person regularly. And that makes a difference. A lot. I think I use Padre exactly because I met Gabor and Sebastian (sewi) last year at CeBIT and they got me interested again in that nice editor/IDE thing …
So guys, keep up the good work, both on the code and the community.