Unicode Greek friendly Unix tools

Tell us about interesting projects involving biblical Greek. Collaborative projects involving biblical Greek may use this forum for their communication - please contact jonathan.robie@ibiblio.org if you want to use this forum for your project.
caseyperkins
Posts: 9
Joined: January 23rd, 2015, 3:26 pm

Re: Unicode Greek friendly Unix tools

Post by caseyperkins »

Jonathan Robie wrote:
caseyperkins wrote:I would say stick with Perl. This kind of thing is where Perl really excels. I was able to work with Perl for processing Unicode Greek texts with much greater ease than would have been possible with other programming languages.
Compared to Python or Ruby? What advantages do you see?

My impression is that these languages are broadly similar in what they can do.
It may be that I am outdated in my conceptions of Python and Ruby's current capabilities in this regard. (I use Python nearly every day, but not for this purpose). When I researched this for a project a few years ago, both - especially Ruby - were behind Perl in Unicode processing capabilities, and Perl did everything I needed it to do, with aplomb.
Stephen Carlson
Posts: 3350
Joined: May 11th, 2011, 10:51 am
Location: Melbourne
Contact:

Re: Unicode Greek friendly Unix tools

Post by Stephen Carlson »

I discovered that the Unicode::Collate module in Perl does the right thing.

I'm sure I'm not the prettiest coder, but here's something that sorts lines with Unicoded Greek text:

Code: Select all

#!/usr/bin/perl -la
BEGIN {
    use utf8;
    use Encode;
    use Unicode::Collate;
    $Collator = Unicode::Collate->new();
}
push @x, decode_utf8($_);
END {
    map { print encode_utf8($_) } $Collator->sort(@x);
}
Stephen C. Carlson, Ph.D.
Melbourne, Australia
Post Reply

Return to “Projects”