iso8859-2 or latin2

[email protected]
Newsgroups gmane.comp.python.windows-ce
Message-ID <[email protected]>
#!/usr/bin/python
# -*- coding: latin2 -*-
import os, sys
print sys.getdefaultencoding()
print sys.getfilesystemencoding()

The result is the folowing:

mbcs
ascii

I use hungarian characters in my program.
I write an application for polisters in PythonCE 2.5
I'd like use it with tkinter and sqlite.

The sqlite database encoding can be utf-8 or iso8859-2.
I tried both.

The test code is folowing:
# -*- coding:utf-8 -*-
latin2_decoder = lambda s: s.encode("iso8859-2", "replace") # str(s)
from sqlite3 import dbapi2 as sqlite
con=sqlite.connect("\\SD Card\\work\\python\\cdata.db",isolation_level=None)
con.text_factory=latin2_decoder
cur=con.cursor()

cur.execute("select ctyid,name from cities")
row=cur.fetchone()
while row:
  print row[0],row[1]
  row=cur.fetchone()
con.close()

Printing hungarian specific characters are failed or simply rectangles
displayed in place of characters.

sys.setdefaultencoding() procedure doesnt exists.
Can anybody help me, please?

best regards
Zoltan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.