Subject | connecting to db with Chinese name |
---|---|
Author | Hamish Moffatt |
Post date | 2017-10-03T02:17:15Z |
Hi,
I'm trying to connect to a db with a Chinese filename. My code is simply:
import fdb
dbname = u'localhost:/home/hamish/汉密斯.fdb'
db = fdb.connect(dsn=dbname)
On Python 3.5.3 this works, but on 2.7.13 it doesn't. Same code, same
fdb (1.8). Both on linux (Debian stretch).
fdb.fbcore.DatabaseError: ('Error while connecting to database:\n-
SQLCODE: -924\n- Invalid connection string\n- Cannot transliterate
character between character sets\n- Invalid or incomplete multibyte or
wide character', -924, 335544972)
It does work on an older Python 2.7.9 install I have, although for some
reason on that setup fdb.fbcore._FS_ENCODING = ANSI_X3.4-1968 not UTF-8,
so I had to override it.
Speaking of the file system encoding detection, doesn't this depend on
the remote host, not local where it's detected? On my Windows python 2
install, the encoding is 'mbcs', not UTF-8. I'm also having issues
trying to connect to a Chinese-named db on Windows.
Hamish
I'm trying to connect to a db with a Chinese filename. My code is simply:
import fdb
dbname = u'localhost:/home/hamish/汉密斯.fdb'
db = fdb.connect(dsn=dbname)
On Python 3.5.3 this works, but on 2.7.13 it doesn't. Same code, same
fdb (1.8). Both on linux (Debian stretch).
fdb.fbcore.DatabaseError: ('Error while connecting to database:\n-
SQLCODE: -924\n- Invalid connection string\n- Cannot transliterate
character between character sets\n- Invalid or incomplete multibyte or
wide character', -924, 335544972)
It does work on an older Python 2.7.9 install I have, although for some
reason on that setup fdb.fbcore._FS_ENCODING = ANSI_X3.4-1968 not UTF-8,
so I had to override it.
Speaking of the file system encoding detection, doesn't this depend on
the remote host, not local where it's detected? On my Windows python 2
install, the encoding is 'mbcs', not UTF-8. I'm also having issues
trying to connect to a Chinese-named db on Windows.
Hamish