develooper Front page | perl.perl5.porters | Postings from February 2012

Re: Unicode cheatsheet for Perl

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
February 20, 2012 10:47
Subject:
Re: Unicode cheatsheet for Perl
Message ID:
6431.1329763624@chthon
Alberto Simões <albie@alfarrabio.di.uminho.pt> wrote
   on Mon, 20 Feb 2012 18:06:01 GMT: 

> Am I missed anything?

> search by Unicode gave no results :S

I don't understand what you mean. 

The normal reason that Unicode searches fail is that one or both 
of the source code or the input should have been specified as being 
encoded in UTF-8 but weren't.

For example, replace the ellipsis with your search:

    use utf8;
    upe v5.14;
    use strict;
    use warnings;
    use open qw(:std :utf8);
    use warnings "FATAL" => "utf8";
    use charnames qw(:full :short latin greek);

    use Unicode::Normalize;

    while (<>) {
        $_ = NFD($_);
        ...
    } continue {
        print NFC($_);
    } 


And if you're running blead, you may add :loose to charnames.

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About