python 2.3.4, cx_Oracle 4.1 and utf-8 - trouble

2005-05-12 Thread Maxim Kuleshov
Hello!

Trying to fetch long varchar2 column and get the following error:

cx_Oracle.DatabaseError: column at array pos 0 fetched with error: 1406

i.e. string buffer is not much enough to fetch the string.

# fragment of code...
myCon = cx_Oracle.connect(user, psw, dsn)
myCur = myCon.cursor()
myCur.execute("""
select COLUMN from TABLE where ID=1
""")
for record in myCur.fetchall():
# ...

Error is reproduced only if actual string value longer than half of
declared column size. For short strings all is ok.

If I print myCur.description, I get:

[('COLUMN', , 250, 250, 0, 0, 1)]

250 - declared column max size, but I guess cx_Oracle allocates only 250
bytes(!), so if my string longer than 125 chars (utf-8 national char
occupies > 1 byte) - I get the error.

Is it bug or what? Any suggestions?

Extra info:
  OS - SuSE Linux 9.2
  Client - Oracle Client 9.2.0.1.0
  NLS_LANG="RUSSIAN_CIS.UTF8"

--
Best regards, Maxim Kuleshov
-- 
http://mail.python.org/mailman/listinfo/python-list


Internationalized To:'s and Cc:'s

2009-10-07 Thread Maxim Kuleshov
Hello!

How should I correctly construct internationalized base64'ed MIME
header?
The problem is that 'real name' _should_ be encoded, but the email
address - should not.
For example, ?utf-8?bla-bla=?=  should be the correct
format, and
?utf-8?bla-bla-bla-bla=?= - incorrect.

But email.Header encodes full text including address, and then local
mail server append's local domain name as it is not found in encoded
header in plain form.

I could manually base64 encode real name, append address, put it in
header without encoding, but is there any more suitable way doing it?
(telling Header to leave address part of header un-encoded).
-- 
http://mail.python.org/mailman/listinfo/python-list