Encoding problems with DCOracle2

Timo Virkkala wt at nic.fi
Mon Sep 15 07:57:25 CEST 2003


Peter Otten wrote:
> Timo Virkkala wrote:
>>I'm having some trouble with Python2.2 and DCOracle2. I'm successfully
>>executing a query, and getting the result I'm hoping for - with an added
>>bonus of some interesting encoding. The beginning of the result set I
>>get looks like this:
>>
>>[['\x00A\x001', '\x00M\x00i\x00k\x00e\x00
>>\x00P\x00o\x00r\x00t\x00n\x00o\x00y', None, None,
>>'\x00d\x00r\x00u\x00m\x00s'], ...
> 
> Seems you are getting unicode from the db. Here's how to convert it to
> latin1:
> 
> >>>unicode('\x00P\x00o\x00r\x00t\x00n\x00o\x00y', 'utf-16-be').encode('latin1')
> 'Portnoy'

Thanks, that solved it! Now, it feels like I'm treating a symptom here, 
not the cause. Is there a way to set the database (Oracle 9i) to send me 
something else than Unicode?

-- 
Timo Virkkala | wt at nic.fi

   "In the battle between you and the world, bet on the world."





More information about the Python-list mailing list