I have run into something sort of odd.... I wanted to give users of a web
application a list of date locales to pick from for personalizing their
displays. So I created a hash of mappings from each
DateTime::Locale->ids() value to the name for each Locale object. The code
looks something like this:
my @data ;
foreach my $id ( DateTime::Locale->ids() ) {
my $ref = DateTime::Locale->load( $id ) ;
if ($ref) {
push(@data, { val => $id, desc => $ref->name() } ) ;
}
}
The @data list is then sorted (by desc) and used to populate a <select>
element in a web form. Here's the weird thing. When I am using this under
Apache on a Linux platform in a CGI application, I get a warning that I am
printing 'wide characters' when I use data from the 'desc' as the content
of an 'option' element. What I *think* is that the data coming out of
DateTime::Locale is not properly encoded as Perl's utf8 internal encoding.
If I take the outout of the name() and native_name() methods and encode
them using "Encode", then it no longer complains. Is this expected
behavior?
--
Shane McCarron
[email protected]