Issue 1771381: bsddb can't use unicode keys (original) (raw)

Issue1771381

Created on 2007-08-10 02:32 by moghe, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bug.txt moghe,2007-08-10 02:32 python interpreter log
Messages (3)
msg32618 - (view) Author: Erol Aktay (moghe) Date: 2007-08-10 02:32
bsddb throws a TypeError when I try to use an unicode string as key name; i.e. bsddb.btopen("foobar", "c")[u'foo'] = "bar" fails I discovered it while experimenting with the shelve module. You may find more information in the attached file. Python version: 2.5.1 OS: Windows XP SP2 (5.1.2600)
msg55180 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2007-08-23 18:55
Unassigning since I don't know the details of bsddb.
msg55238 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2007-08-24 03:57
The BerkeleyDB library operates on bytes only. Unicode doesn't make sense as a key without converting it to a particular encoding first. Use the unicode object's encode() method if you need to use it as a database key or create a wrapper object or subclass of the db that automatically does that for you as appropriate.
History
Date User Action Args
2022-04-11 14:56:25 admin set github: 45295
2007-08-24 03:57:06 gregory.p.smith set status: open -> closedversions: + Python 2.5nosy: + gregory.p.smithmessages: + assignee: gregory.p.smithresolution: wont fix
2007-08-23 18:55:45 lemburg set assignee: lemburg -> (no value)messages: +
2007-08-10 02:32:23 moghe create