Hey folks,

I'm utilizing DateTime::Locale to get at the month names for different
languages. With Catalyst I'm having problems with the encoding of special
characters used in the month names:

Controller:
$c->stash->{ 'month_names' } =
  DateTime::Locale->load( 'de' )->month_names;

Template:
[% month_names.join(",") %]

gives me:
Januar,Februar,M[questionmark]rz,April etc.

Explicitly encoding the month names as utf8 fixes the error:

$c->stash->{ 'month_names_encoded' } = [
  map { encode( 'utf8' ) }
    @{ DateTime::Locale->load( 'de' )->month_names }
];

(The content-type is set to utf-8.)

Any ideas what's going on or what I'm doing wrong? The explicit encoding
shouldn't be neccessary IMHO and it makes it hard to use third-party modules
(e.g. form generation/validation frameworks) that build on DateTime::Locale to
generate a list of month_names for the given locale.

Thanks!

--Tobias

Reply via email to