In the process of porting a p5-Gtk2 extension (Gtk2::Ex::Clock), I get the following error when running the examples:

Unknown encoding '646' at /usr/local/libdata/perl5/site_perl/Gtk2/Ex/Clock.pm line 198
The block is:
  my $charset = I18N::Langinfo::langinfo (I18N::Langinfo::CODESET());
  require Encode;
  if ($charset eq '646' && !Encode::resolve_alias("646")) {
      require Encode::Alias;
#      Encode::Alias::define_alias(646 => 'ascii');
  }
  $format = Encode::encode ($charset, $format);
198 being the last line pasted. This seems to be similar to the problem in this thread: http://marc.info/?l=openbsd-ports&m=113337435515885&w=2 except that Encode.pm doesn't check /usr/local/lib/charset.alias. Applying the fix at the end of this message 'fixes' it (it uses Encode::Alias to add an alias from 646 to 'ascii') but what is the correct thing to do here?

--- lib/Gtk2/Ex/Clock.pm.orig    Tue Mar 10 00:38:25 2009
+++ lib/Gtk2/Ex/Clock.pm    Tue Mar 10 00:43:55 2009
@@ -195,6 +195,10 @@ sub strftime_wide {
  require I18N::Langinfo;
  my $charset = I18N::Langinfo::langinfo (I18N::Langinfo::CODESET());
  require Encode;
+  if ($charset eq '646' && !Encode::resolve_alias("646")) {
+      require Encode::Alias;
+      Encode::Alias::define_alias(646 => 'ascii');
+  }
  $format = Encode::encode ($charset, $format);
  my $str = POSIX::strftime ($format, @args);
  return Encode::decode ($charset, $str);


Reply via email to