http://www.perlmonks.org?node_id=830172


in reply to Re: "wide character in print" error in DBM::Deep
in thread "wide character in print" error in DBM::Deep

I did a bit of studying (DBM-Deep-1.0016).

No encoding is done anywhere, as far as I've seen. Definitely a major bug. Two possible fixes:

The latter should be simpler, more efficient, and allows the preservation of the UTF8 flag. Basically, adjust write_value and add

package DBM::Deep::Engine::Sector::Unicode; use 5.006_000; use strict; use warnings FATAL => 'all'; no warnings 'recursion'; use base qw( DBM::Deep::Engine::Sector::Scalar ); sub type { $_[0]{engine}->SIG_UNICODE } sub _init { my $self = shift; utf8::encode( $self->{data} ) if $] >= 5.008 && defined($self->{data}); $self->SUPER::_init(); } sub data { my $self = shift; my $data = $self->SUPER::data(); utf8::decode( $data ) if $] >= 5.008; return $data; } 1; __END__

And that's just for values. A separate fix is needed for the keys, I believe.