Git Product home page Git Product logo

Comments (1)

shawnbrown avatar shawnbrown commented on July 28, 2024

I'm not sure if I have an answer for you but have you tried specifying the encoding?

If you know what encoding you have, you might be able to get it to work this way. The DBF() constructor's optional second argument is for an encoding:

table = DBF('asset.dbf', 'UTF-8')
for record in table:
    print(record)
table = DBF('asset.dbf', 'Latin-1')
for record in table:
    print(record)

Another option is to set the char_decode_errors handler. The argument defaults to 'strict' when unspecified.

So this...

table = DBF('asset.dbf')

Is the same as...

table = DBF('asset.dbf', char_decode_errors='strict')

But you could relax this requirement by specifying a more forgiving error handler (see Python's Error Handlers docs for more options):

table = DBF('asset.dbf', char_decode_errors='replace')

You might settle on some combination of the two... defining an expected encoding and loosening the error handling behavior:

table = DBF('asset.dbf', 'Latin-1', char_decode_errors='replace')
for record in table:
    print(record)

from dbfread.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.