Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: hash tied to GDBM_FILE causes Wide character in null operationby ikegami (Patriarch) |
on Nov 30, 2011 at 23:44 UTC ( [id://940972]=note: print w/replies, xml ) | Need Help?? |
There's three approaches the authors could have taken.
The implementers went with the first. It's the only one that allows the module to read any GDBM file, and that's extremely important. That leaves it up to the user to serialise strings of text into strings of bytes by encoding them. I suppose its constructor could accept an argument specifying an encoding, allowing the user to choose whether he wants the first or second behaviour. I guess the authors didn't consider that, but that's excusable because the module predates Perl's support for strings of non-ASCII text. Your error is that your string contains the characters
so one of the characters isn't a byte, yet the module expects bytes. Note that UTF-8 isn't always produced. Only when garbage (something that isn't a string of bytes) is given.
In Section
Seekers of Perl Wisdom
|
|