473,563 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Encoding problems with DCOracle2

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\x00 k\x00e\x00
\x00P\x00o\x00r \x00t\x00n\x00o \x00y', None, None,
'\x00d\x00r\x00 u\x00m\x00s'], ...

So, where are those \x00 -characters coming? It should read:

[['A1', 'Mike Portnoy', None, None, 'drums'], ...

(...it's an artist database, and that's Dream Theater's drummer..)

--
Timo Virkkala | wt@nic.fi

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

Jul 18 '05 #1
2 1642
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\x00 k\x00e\x00
\x00P\x00o\x00r \x00t\x00n\x00o \x00y', None, None,
'\x00d\x00r\x00 u\x00m\x00s'], ...

So, where are those \x00 -characters coming? It should read:

[['A1', 'Mike Portnoy', None, None, 'drums'], ...

(...it's an artist database, and that's Dream Theater's drummer..)


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('la tin1')
'Portnoy'


Peter
Jul 18 '05 #2
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\x00 k\x00e\x00
\x00P\x00o\x0 0r\x00t\x00n\x0 0o\x00y', None, None,
'\x00d\x00r\x 00u\x00m\x00s'], ...


Seems you are getting unicode from the db. Here's how to convert it to
latin1:
unicode('\x0 0P\x00o\x00r\x0 0t\x00n\x00o\x0 0y', 'utf-16-be').encode('la tin1')

'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@nic.fi

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

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1621
by: Skip Montanaro | last post by:
Connections to remote Oracle databases doesn't seem possible with DCOracle2. I have no problem making remote connections using Perl's DBI::Oracle package, so I know it's possible in theory. Is this capability available in DCOracle2 but just not documented perhaps? Thx, Skip
0
1348
by: the_rev_dharma_roadkill | last post by:
I've have some fun getting DCOracle2 (python-to-oracle interface) going on HP/Compaq Tru64 with Oracle8i Release 3 (oracle 8.1.7). I'd like to share an answer/bug-fix with you: After un-tarring the source... 1) edit setup.py. Change the lines: CFLAGS = LFLAGS = LIBS=
2
2040
by: Olaf Meyer | last post by:
I'm having some problems compiling Python 2.3.3 on HP-UX (B.11.00). I've tried sevral different options for the configure script (e.g. enabling/disabling gcc, aCC) but I always get the same problem during the final linking stage. Several PyThread_* symbols are undefined (for details see the output below). In order to get DCOracle2 support...
3
1669
by: Ron Reidy | last post by:
All, I am trying to compile DCOracle2 on RedHat 8.0 and make is giving me the following error: gcc -pthread -fPIC -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/usr/local/include/python2.3 -I/usr/local/include/python2.3 @DEFS@ -I/oracle/app/oracle/9i/rdbms/demo -I/oracle/app/oracle/9i/network/public -I/oracle/app/oracle/9i/plsql/public
0
1068
by: Dave Harrison | last post by:
Hi All, Im trying to use the DCOracle2 library but I've never worked with Oracle before, yet have to investigate the effort involved in porting a database we have to it. When I try running a `make` in the DCOracle2 dir having set the env variables correctly I get the following error : make || ./builderrors)
0
1098
by: Dave Harrison | last post by:
hi all, Im trying to install DCOracle2 but I cant seem to find out how to install the Oracle header files that the library needs (...rdbms/demo is empty). Ive installed both the db and the client, but still no header files. can anyone help out with a pointer ?
0
1036
by: Keana | last post by:
Hi, I am trying to retrieve data from an Oracle DB table. One of the columns is defined as 'Long Raw' data type and contains multi-line string data (with newlines). My query returns 'None' for this column although there is data in the rows I am retrieving. Can someone tell me how to get around this problem? I am using DCOracle2 v2.1.2...
2
1978
by: pepericou | last post by:
I'm trying to developp an application which use Zope and DCOracle2 module to access Oracle database. I've install the DCOracle2 product on Windows XP, but when I create a python function to access my database, I' have the following error when I test it : import DCOracle2 is unauthorized Can You help me ? Thank you
2
1544
by: Chris | last post by:
Hello I'm using DCOracle2 with Python 2.1 and Oracle 8.1.7 on Solaris and while it's working most of the time, I have random ORA-01084 invalid argument in OCI call errors that occur on INSERT. Out of 18000 queries all using the same DB connection I have like 15 errors of this type. It's always the same SQL queries (2 different INSERT and...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.