I know that this node is somewhat duplicate of things said above, but as a ISO-8859-2 user, I would like to emphasize that you will need to setup LC_CTYPE and use locale.
You should also consider setuping LC_COLLATE so that sort also uses locale.
You will have to have locale installed on your system. Try setting enviroment variables and running perl -v to see if perl picks up locale (it will complain if it doesn't).
Having said that, locale setup is done per language and country (that's why locale for Croatia is hr_HR and for USA en_US). You might also use locale aliases (defined in /usr/lib/X11/locale/locale.alias).
It might be enough just to add use locale; in your code. If you need. Example follows (for Croatia with it's funny accented characters; we use ISO-8859-2, but principle is the same).
#!/usr/bin/perl -w
use strict;
use locale;
use POSIX qw(locale_h);
setlocale(LC_CTYPE, 'hr_HR');
setlocale(LC_COLLATE, 'hr_HR');
my $text = "foo čevapčić bar";
print join(", ",sort split(/\W/,$text)),"\n";
If you are not bothered with changing system-wide locale, you can also setup your /etc/profile and apache's httpd.conf with enviroment variables and drop setlocale from code.
|