--- gettext-1.05/gettext.pm- 2005-06-01 07:11:16 +0400 +++ gettext-1.05/gettext.pm 2005-06-02 19:10:02 +0400 @@ -37,14 +37,6 @@ require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); -BEGIN { - eval { - require Encode; - $encode_available = 1; - }; - import Encode if ($encode_available); -} - $VERSION = "1.05" ; %EXPORT_TAGS = ( @@ -98,18 +90,9 @@ sub domain_raw { sub domain { my ($class, $domain) = @_; - unless ($encode_available) { - croak "Encode module not available, cannot use Locale::gettext->domain"; - } my $self = { domain => $domain, raw => 0 }; bless $self, $class; - eval { bind_textdomain_codeset($self->{domain}, "UTF-8"); }; - if ($@ =~ /not implemented/) { - # emulate it - $self->{emulate} = 1; - } elsif ($@ ne '') { - die; # some other problem - } + bind_textdomain_codeset($self->{domain}, "UTF-8"); $self; } @@ -207,23 +190,8 @@ sub codeset { sub _convert { my ($self, $str) = @_; return $str if ($self->{raw}); - # thanks to the use of UTF-8 in bind_textdomain_codeset, the - # result should always be valid UTF-8 when raw mode is not used. - if ($self->{emulate}) { - delete $self->{emulate}; - $self->{raw} = 1; - my $null = $self->get(""); - if ($null =~ /charset=(\S+)/) { - $self->{decode_from} = $1; - $self->{raw} = 0; - } #else matches the behaviour of glibc - no null entry - # means no conversion is done - } - if ($self->{decode_from}) { - return decode($self->{decode_from}, $str); - } else { - return decode_utf8($str); - } + require Encode; + return Encode::decode_utf8($str); } sub DESTROY { --- gettext-1.05/gettext.xs- 2005-06-01 06:05:00 +0400 +++ gettext-1.05/gettext.xs 2005-06-02 19:09:34 +0400 @@ -52,6 +52,7 @@ constant(char *name, int arg) #endif #if ANY_MISSING +#error missing gettext functions static int not_here(char *s) {