msg62456 - (view) |
Author: Damien Elmes (resolve1) |
Date: 2008-02-16 14:08 |
The docs on http://docs.python.org/lib/sqlite3-Module-Contents.html
should mention that the connection string should always be UTF-8,
regardless of the encoding system of the underlying filesystem. See the
'note to windows users' on
http://www.sqlite.org/c3ref/open.html
|
msg62558 - (view) |
Author: Virgil Dupras (vdupras) |
Date: 2008-02-19 11:53 |
+1 I've been pulling my hair off over this one too. Try this on win32:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.mkdir(u'foo\xe9')
>>> import sqlite3
>>> con = sqlite3.connect(u'foo\xe9\\my.db')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 3:
ordinal not in range(128)
>>> import sys
>>> sys.getfilesystemencoding()
'mbcs'
>>> con = sqlite3.connect(u'foo\xe9\\my.db'.encode(sys.getfilesystemencoding()))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
sqlite3.OperationalError: unable to open database file
>>> con = sqlite3.connect(u'foo\xe9\\my.db'.encode('utf-8'))
>>>
|
msg62611 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * |
Date: 2008-02-21 09:16 |
IMO, connect() should accept unicode strings, and encode them to utf-8
when calling the C function.
Patch attached.
|
msg62639 - (view) |
Author: Virgil Dupras (vdupras) |
Date: 2008-02-21 18:45 |
Shouldn't we apply this patch directly on pysqlite? Any change made to
the sqlite3 module will be overwritten in the next "refresh", right?
Anyway, I'm not 100% sure, but it might already be fixed:
http://www.initd.org/tracker/pysqlite/changeset/452
So, maybe create a ticket to use the latest version of pysqlite?
|
msg62663 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * |
Date: 2008-02-21 21:42 |
> So, maybe create a ticket to use the latest version of pysqlite?
I don't think so. While the change you are pointing to does deal with
the same problem, the base versions seems to have substantial differences.
I still prefer my patch.
|
msg63078 - (view) |
Author: Gerhard Häring (ghaering) * |
Date: 2008-02-27 20:10 |
I'll assign this one to me. The "sqlite3" module cannot be just
"refreshed" with the externally maintained pysqlite, I'll have to do
merging anyway. Don't worry here ;-)
|
msg63095 - (view) |
Author: Virgil Dupras (vdupras) |
Date: 2008-02-28 15:56 |
Ok then, we need a test for this. Patch attached.
However, I don't know if I applied Amaury's patch wrong or if I miss a
./configure option or something, but even with the patch, the test fails.
Another thing: Why isn't the sqlite3 test suite a part of python's
regression test suite? Or is it and I didn't notice?
|
msg63111 - (view) |
Author: Gerhard Häring (ghaering) * |
Date: 2008-02-28 22:55 |
I didn't try the patch out, yet. But I'd instead try to just open
u":memory" instead.
Also, in Lib/test/test_sqlite.py the sqlite tests are started. They are
of course run as part of the Python test suite.
|
msg63127 - (view) |
Author: Virgil Dupras (vdupras) |
Date: 2008-02-29 07:18 |
u':memory:'? That already worked before the patch because the implicit
encoding with 'ascii' does not bump into any non-ascii character. Nope,
one has to call connect with a filename containing non-ascii characters.
|
msg63249 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * |
Date: 2008-03-04 09:21 |
Sorry, my patch corrected only sqlite3.Connection().
I join a new version, which also changes sqlite3.connect().
By the way, the test should test that the file is created with the
correct name. A call to os.stat() could be enough.
|
msg66209 - (view) |
Author: Gerhard Häring (ghaering) * |
Date: 2008-05-04 13:54 |
The implementation in SVN should in the meatntime behave like you expect
now. Look for database_utf8 = PyUnicode_AsUTF8String(database); in
connection.c to see the implementation.
|
msg71930 - (view) |
Author: Gerhard Häring (ghaering) * |
Date: 2008-08-25 14:45 |
Can we close this now? Did you try out a Python2.6 or Python 3.0 beta?
|
msg73952 - (view) |
Author: A.M. Kuchling (akuchling) * |
Date: 2008-09-28 00:26 |
vdupras's test case now passes with Python 2.6; we should apply
the patch to the test suite, though. We could ask Barry if he wants to
apply it to 2.6rc, or adding the test can wait until 2.7.
|
msg86485 - (view) |
Author: Jeroen Ruigrok van der Werven (asmodai) * |
Date: 2009-04-25 12:07 |
What do we want to do with this one, because it is now seems out of
scope for documentation given the changes Gerhard implemented.
|
msg86523 - (view) |
Author: Georg Brandl (georg.brandl) * |
Date: 2009-04-25 15:01 |
Looks like that's the case.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:30 | admin | set | github: 46380 |
2009-04-25 15:01:49 | georg.brandl | set | status: open -> closed resolution: fixed messages:
+ msg86523
|
2009-04-25 12:07:52 | asmodai | set | nosy:
+ asmodai messages:
+ msg86485
|
2008-09-28 00:26:30 | akuchling | set | nosy:
+ akuchling messages:
+ msg73952 |
2008-08-25 14:45:06 | ghaering | set | messages:
+ msg71930 |
2008-05-04 13:54:29 | ghaering | set | messages:
+ msg66209 |
2008-03-04 09:22:02 | amaury.forgeotdarc | set | files:
- sqlite_connect.diff |
2008-03-04 09:21:52 | amaury.forgeotdarc | set | files:
+ sqlite_connect2.diff messages:
+ msg63249 |
2008-02-29 07:18:32 | vdupras | set | messages:
+ msg63127 |
2008-02-28 22:55:28 | ghaering | set | messages:
+ msg63111 |
2008-02-28 15:57:00 | vdupras | set | files:
+ sqlite_connect_test.diff keywords:
+ patch messages:
+ msg63095 |
2008-02-27 20:10:02 | ghaering | set | severity: normal -> minor messages:
+ msg63078 priority: low assignee: ghaering keywords:
+ easy type: enhancement |
2008-02-27 20:05:20 | ghaering | set | nosy:
+ ghaering |
2008-02-21 21:42:37 | amaury.forgeotdarc | set | messages:
+ msg62663 |
2008-02-21 18:45:12 | vdupras | set | messages:
+ msg62639 |
2008-02-21 09:16:17 | amaury.forgeotdarc | set | files:
+ sqlite_connect.diff nosy:
+ amaury.forgeotdarc messages:
+ msg62611 |
2008-02-21 02:10:32 | benjamin.peterson | set | nosy:
+ georg.brandl |
2008-02-19 11:53:45 | vdupras | set | nosy:
+ vdupras messages:
+ msg62558 |
2008-02-16 14:08:47 | resolve1 | create | |