mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
make sure we pass filename as utf8 to sqlite
This commit is contained in:
parent
f3a1916c07
commit
4c7f7a7c4b
1 changed files with 7 additions and 2 deletions
|
@ -37,7 +37,7 @@ class Upgrader(object):
|
||||||
|
|
||||||
def check(self, path):
|
def check(self, path):
|
||||||
"True if deck looks ok."
|
"True if deck looks ok."
|
||||||
with DB(path) as db:
|
with DB(self._utf8(path)) as db:
|
||||||
return self._check(db)
|
return self._check(db)
|
||||||
|
|
||||||
def _check(self, db):
|
def _check(self, db):
|
||||||
|
@ -111,12 +111,17 @@ f.id = cards.factId)"""):
|
||||||
|
|
||||||
def _openDB(self, path):
|
def _openDB(self, path):
|
||||||
self.tmppath = tmpfile(suffix=".anki2")
|
self.tmppath = tmpfile(suffix=".anki2")
|
||||||
shutil.copy(path, self.tmppath)
|
shutil.copy(path, self._utf8(self.tmppath))
|
||||||
self.db = DB(self.tmppath)
|
self.db = DB(self.tmppath)
|
||||||
|
|
||||||
def _openCol(self):
|
def _openCol(self):
|
||||||
self.col = _Collection(self.db)
|
self.col = _Collection(self.db)
|
||||||
|
|
||||||
|
def _utf8(self, txt):
|
||||||
|
if isinstance(txt, unicode):
|
||||||
|
return txt.encode("utf8")
|
||||||
|
return txt
|
||||||
|
|
||||||
# Schema upgrade
|
# Schema upgrade
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue