in reply to Re: ISO 8859-1 characters and \w \b etc.
in thread ISO 8859-1 characters and \w \b etc.
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).
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.#!/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";
|
|---|