[prev in list] [next in list] [prev in thread] [next in thread]
List: sapdb-general
Subject: Re: Please help me with unicode problem
From: Daniel Dittmar <daniel () dittmar ! net>
Date: 2007-02-14 8:09:32
Message-ID: 45D2C3BC.6050904 () dittmar ! net
[Download RAW message or body]
À̹οì wrote:
> I use python interface module, and I use that very well.
> But I have a problem when I excute insert command.
> There are some Korean in that query sentence.
> After I excuted that command, the characters was not shown normaly.
> I tried many times to find what's the problem.
> I concluded that the characters was converted to latin.
> It's like unicode(str,'latin-1').
> But I need unicode(str,'euc-kr').
There is no way to automatically use a different encoding when inserting
ordinary (= non unicode) Python strings into unicode columns.
You could wrap the insert statement:
class Encoder:
def __init__ (self, prepared):
self.prepared = prepared
def execute (self, args):
converted = []
for value in args:
if type (value) == type (''):
value = unicode(str,'euc-kr')
converted.append (value)
self.prepared.execute (converted)
use as
prepared = Encoder (session.prepare ('...'))
prepared.execute ([...])
Daniel
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/maxdb?unsub=sapdb-general@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic