Re: Unicode (UTF8) in dbhas on 2.5

2008-10-22 Thread Paul Boddie
On 21 Okt, 22:39, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > It's not possible to "fix" this - it isn't even broken. The *db modules, > by design, support storing of arbitrary bytes, not just character data. > You can put images into them, or sound files, java byte code files, etc. > So if Py

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Martin v. Löwis
>> Many database engines are encoding-aware, and distinguish between >> 'text' columns and 'blob' columns -- the latter are arbitrary bags >> of bytes, but text columns store text, and a good database (with a >> sensibly designed database) will be aware of this and handle >> encoding and decoding o

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Joe Strout
On Oct 21, 2008, at 2:39 PM, Martin v. Löwis wrote: It's not possible to "fix" this - it isn't even broken. The *db modules, by design, support storing of arbitrary bytes, not just character data. Many database engines are encoding-aware, and distinguish between 'text' columns and 'blob'

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Martin v. Löwis
Paul Boddie wrote: > On 20 Okt, 16:04, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> What is the difference? The dbhash module can only work with *bytestrings*. >> Bytestrings are just that - a sequence of 8-bit-values. > > Sounds like a prime candidate for some improvement work. Patches, > any

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Diez B. Roggisch
Yves Dorfsman wrote: > Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > >> Please write the following program and meditate at least 30min in front >> of it: > >> while True: >>print "utf-8 is not unicode" > > I hope you will have a better day today than yesterday ! I had a good day yesterday.

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Jerry Hill
On Tue, Oct 21, 2008 at 10:16 AM, Yves Dorfsman <[EMAIL PROTECTED]> wrote: > My terminal is setup in UTF-8, and... It did print correctly. I expected > that by setting coding: utf-8, all the I/O functions would do the encoding > for me, because if they don't then I, and everybody who writes a scrip

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Paul Boddie
On 20 Okt, 16:04, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > What is the difference? The dbhash module can only work with *bytestrings*. > Bytestrings are just that - a sequence of 8-bit-values. Sounds like a prime candidate for some improvement work. Patches, anyone? ;-) > u""-literals ar

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-21 Thread Yves Dorfsman
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Please write the following program and meditate at least 30min in front of > it: > while True: >print "utf-8 is not unicode" I hope you will have a better day today than yesterday ! Now, I did this: while True: print "¡ Python knows about enco

Re: Unicode (UTF8) in dbhas on 2.5

2008-10-20 Thread Diez B. Roggisch
Yves Dorfsman wrote: > Can you put UTF-8 characters in a dbhash in python 2.5 ? > It fails when I try: > > #!/bin/env python > # -*- coding: utf-8 -*- > > import dbhash > > db = dbhash.open('dbfile.db', 'w') > db[u'smiley'] = u'☺' > db.close() > > Do I need to c

Unicode (UTF8) in dbhas on 2.5

2008-10-20 Thread Yves Dorfsman
Can you put UTF-8 characters in a dbhash in python 2.5 ? It fails when I try: #!/bin/env python # -*- coding: utf-8 -*- import dbhash db = dbhash.open('dbfile.db', 'w') db[u'smiley'] = u'☺' db.close() Do I need to change the bsd db library, or there is no way to