From: Yaroslav S. <ya...@gm...> - 2010-07-07 15:27:34
|
On 07.07.2010, at 14:16, Dennis Follensbee wrote: > Hello- > > I’ve been a user of dbfpy for a number of years, now, and I’m > curious if it supports utf-8. I tried, for example, writing a > Unicode character to a dbf and got garbage in the output. >>> from dbfpy import dbf >>> db = dbf.Dbf('test.dbf') >>> for rec in db: print rec["name"].decode("utf-8") ... € What type of garbage do you have in the output? > I’m developing this dbf for use in ArcGIS. > > Here is an example: > > # -*- coding: utf8 -*- > from dbfpy import dbf > > def Test123(sOutDir): > pOutDBF = dbf.Dbf(sOutDir, new=True) > pOutDBF.addField(("NAME", "C", 105)) > return pOutDBF > > def ProcessIt(): > dbWriter = Test123(r"test.dbf") > fdWriter = open("test.txt", "w") > s = u"€" > pRec = dbWriter.newRecord() > fdWriter.write(s.encode("utf8")) > pRec["NAME"] = s.encode("utf-8") > pRec.store() > fdWriter.close() > dbWriter.close() > > ProcessIt() > > > Dennis Follensbee | GIS Product Engineer | BroadMap LLC | Lebanon, > NH, United States | e-mail: den...@br... | office: > 603.678.4477 | www.broadmap.com | Twitter@BroadMap > <image001.png> > P Please consider the environment before printing this e-mail. > > This email and any files transmitted with it are confidential and > intended solely for the use of the individual/entity to which they > are addressed. If you have received this email in error please let > us know by e-mail reply and delete it from your system. You may not > copy this message or disclose its contents to anyone. E-mail > transmission cannot be guaranteed to be secure or error-free as > information could arrive late, be intercepted, corrupted, lost or > destroyed, be incomplete, or contain viruses. The sender therefore > does not accept liability for any viruses, errors or omissions in > the contents of this message, which arise as a result of e-mail > transmission. BroadMap LLC, 11543-A Nuckols Road, Glen Allen, VA > 23059. www.BroadMap.com > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first_______________________________________________ > Dbfpy-users mailing list > Dbf...@li... > https://lists.sourceforge.net/lists/listinfo/dbfpy-users |