in reply to How to get the Unicode of a character in perl?
Modern Perls (the more modern the better) have mostly native Unicode support. Be sure to use feature qw/unicode_strings/;, and you may need to binmode FH, ':utf8'; your input and output filehandles (STDOUT, for example) so as not to have "wide character" warnings and problems. That said, chr and ord should just work as you wish, even with Unicode.
For more elaborate dealings, you may need one of the Encode modules, or Unicode::Collate, Unicode::UCD, Unicode::Normalize, or other modules.
There is a lot of information out there in Perl's documentation. perlunicode, perluniintro, perlunifaq, perlunitut to name a few. I'm sure that Programming Perl (4th Edition) (due to market in December) will shed additional light on the topic, especially since tchrist is listed as one of the authors. He seems to be waving the Perl Unicode flag a lot these days, so I imagine he will have a lot to contribute on the subject when the book is released. The book Modern Perl deals with Unicode to some degree, and there's a section on it in the Perl Cookbook as well, although the Cookbook was written before Perl really passed puberty with respect to Unicode.
Be glad you're dealing with Perl. Few languages have such a degree of native Unicode support as modern versions of Perl. C++, for example, requires the 3rd party ICU library (or something similar) just to get part of the functionality that ships with Perl 5.14.
Dave
|
|---|