Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't handle multibyte chars correctly #40

Closed
heavenshell opened this issue Nov 15, 2013 · 2 comments
Closed

Can't handle multibyte chars correctly #40

heavenshell opened this issue Nov 15, 2013 · 2 comments

Comments

@heavenshell
Copy link

Hi. Thank you for create nice library.

I've got multibyte problem.

If MySQL's charset is utf8, SQLAlchemy's database connection url should set like following.
mysql://foo:foo_password@localhost/bar_table?charset=utf8&use_unicode=0

Currently, database.py ignore url query string.
So, dataset can't handle multibyte correctly.
SQLAlchemy convert to multibyte char to ? automatically.

--- database.py.orig    2013-11-16 00:55:53.000000000 +0900
+++ database.py 2013-11-16 00:55:46.000000000 +0900
@@ -24,6 +24,7 @@
         kw['poolclass'] = NullPool
     self.lock = threading.RLock()
     self.local = threading.local()
+       original_url = url
     if '?' in url:
         url, query = url.split('?', 1)
         query = parse_qs(query)
@@ -33,7 +34,7 @@
             if len(schema_qs):
                 schema = schema_qs.pop()
     self.schema = schema
-        engine = create_engine(url, **kw)
+       engine = create_engine(original_url, **kw)
     self.url = url
     self.engine = construct_engine(engine)
     self.metadata = MetaData(schema=schema)

Is there any reason to ignore url query?
IMHO dataset should not ignore url query for handling multibyte.

Regards.

@pudo
Copy link
Owner

pudo commented Nov 15, 2013

Yeah, overloading the URL query string to handle dataset arguments was probably a stupid move. I'll try and refactor to leave the non-specific bits of the query string intact. Thanks for pointing it out!

@pudo pudo closed this as completed in b7bbde4 Nov 15, 2013
@heavenshell
Copy link
Author

Awesome! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants