Re: [cx-oracle-users] strange character encoding problems
Brought to you by:
atuining
From: Marcus E. <i...@eg...> - 2006-01-30 11:50:33
|
Hi, thanks for the reply. Amaury Forgeotdarc wrote: > Hello, > > Marcus Eggenberger wrote: > >>I am not able to store characters of the latin-1 charset in my >>oracle-database. I've encoded them according to NLS_CHARACTERSET but >>that doesn't help. >>I'm running Oracle 10g XE, Python 2.4.1 and cx_Oracle 4.1 >> >>Here is some sample code which shows the very strange results: >> >> >>#!/usr/bin/python >> >># -*- coding: iso-8859-1 -*- >> >>import cx_Oracle >>> > > I tried the same script, and I get correct results on my database > for the first two charsets, as expected. > Darn, I really hoped my code would be wrong... > Did you check that your database can handle latin-1 characters? > Take a look at NLS_CHARACTERSET in the NLS_DATABASE_PARAMETERS view. > The Output of NLS_DATABASE_PARAMETERS is the very same as V$NLS_PARAMETERS. NLS_CHARACTERSET: WE8MSWIN1252 NLS_NCHAR_CHARACTERSET: AL16UTF16 > Another thing: the -*- coding -*- line is not correctly placed. > It must be the first or second line of the script. > I don't know if this makes the difference. > In my sources the line was right beneath the shebang line. Otherwise python would have raised an Warning. What's strange too: When I insert a latin-1 character via the oracle htmldb, it is stored correctly. Since it shows up correctly in the htmldb object browser. But when I'm reading this value via my python script the umlauts are gone. This means: ä -> a, ö -> o, ü -> u I'm totally lost with this one. Any other Ideas? Kind regards, Marcus |