Skip to content

No default encoding (2.0.0a1) #162

@ghost

Description

I kept getting the error AttributeError: 'DatabaseWrapper' object has no attribute 'encoding' and it turns out that encoding is only set by default in this block of base.py if there is an OPTIONS key who's value is a dictionary with least one key.

Workaround: add an OPTIONS key to your config that has a populated dictionary

Possible solutions:

  1. Check and set base.py after line 202 with something like
        self.encoding = 'utf-8'

and also update the README.rst to reflect that encoding isn't only set to 'utf-8' by default when OPTIONS is specified

  1. Change line 394 in base.py from 'return CursorWrapper(cursor, self.driver_supports_utf8, self.encoding, self)' to 'return CursorWrapper(cursor, self.driver_supports_utf8, getattr(self, 'encoding'), self)

CursorWrapper's init function is ready to handle None/empty string values, so I'm not sure which solution works better behind the goals of the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions