mcfunley / pugsql

A HugSQL-inspired database library for Python
https://pugsql.org
Apache License 2.0
673 stars 22 forks source link

UTF-8 support? #20

Closed eabra closed 5 years ago

eabra commented 5 years ago

Hi,

is there a way to specify utf8 encoding when connecting to the (sqlite) database? I have utf8 content in the database and it gets back mangled.

Cheers

mcfunley commented 5 years ago

I haven't tried this but this makes it sound like you can just add ?charset=utf-8 to the connection string: https://stackoverflow.com/a/10819357

Failing that you can also configure the engine yourself, i.e.

from sqlalchemy import create_engine
import pugsql

eng = create_engine(custom_params)

m = pugsql.module('sql/')
m.set_engine(eng)
mcfunley commented 5 years ago

Let me know / feel free to reopen if that doesn't work