473,837 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inserting unicode strings in jython

2 New Member
Hi - with the Jython site being down, info here on the following has been difficult to come by!

I'm trying to insert a unicode string into the following table:
`id` int(11) NOT NULL auto_increment,
`description` text,

I'm using jython's zxJDBC classes
from com.ziclix.pyth on.sql import zxJDBC

I'm trying to insert u'Al\u221A\xA9a b' into the databse using:
str = u'Al\u221A\xA9m m' # Alémm
c = db.cursor()
c.execute("inse rt into p1 (description) values( '" + str + "')")

However, when I fetch the result, it is:

I've read several articles on unicode, but don't know if the zxjdbc driver is converting the string or if I need to set some properties.

Any help or insight will be much, much appreciated!

Oct 14 '06 #1
2 2761
6,596 Recognized Expert Expert
AFAIK, there are two versions of (MySQL? I'm guessing from innodb). One has unicode support, the other dosn't. Have you tried posting to the MySQL forum?
Oct 14 '06 #2
2 New Member
Thanks - I will follow up on it. Yes, you can have multiple db types in mysql (innodb and myisam). The reason I think this is a driver issue, possibly, or a config setting I am missing, is that I can go to the sql client and insert the string, and it gets stored as unicode (i'm guessing w/ utf-8 encoding).

When I insert the string using the client, and retrieve it using python, it shows up as a unicode string (in my previous post). However, when I try and re-insert that string, it goes in jacked up.

So, I'm guessing the issue is with Python (well, Jython) driver, or with some setting I am not using correctly.

Oct 14 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Jan Gregor | last post by:
Hello I found that price of += operator on string is too high in jython. For example 5000 such operations took 90 seconds (i generated html copy of table with 1000 rows and 5 columns). Generation of row data into separate string and joining after lead to time 13 seconds !!! What's alternative way to do that ? (similiar parts of my code are terribbly slow and such simple solution as above didn't help).
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3 script that grabs some web pages from the web, regex parse the data and stores it localy to xml file for further use.. at first i had no problem using python minidom and everything concerning
by: Neil Schemenauer | last post by:
python-dev@python.org.] The PEP has been rewritten based on a suggestion by Guido to change str() rather than adding a new built-in function. Based on my testing, I believe the idea is feasible. It would be helpful if people could test the patched Python with their own applications and report any incompatibilities. PEP: 349
by: Jamie | last post by:
I have a file that was written using Java and the file has unicode strings. What is the best way to deal with these in C? The file definition reads: Data Field Description CHAR File identifier (64 bytes corresponding to Unicode character string padded with '0' Unicode characters. CHAR File format version (32 bytes corresponding to Unicode character string "x.y.z" where x, y, z are integers corresponding to major, minor and...
by: shorti | last post by:
Hello, I am running DB2 UDB 8.2 on AIX 5.3. I am running some tests on converting several tables on an existing database to Unicode. The database will not be converted to unicode...just this table set. I have successfully set this up and ran some tests using Japanese characters. The test seemed to work fine. We found during our test that we needed to install some AIX UTF-8 software for the web-based user interface to work properly. ...
by: Thomas Guettler | last post by:
Hi, is it possible to force all non ascii strings to be unicode strings somehow? Sometimes I forget that I need to write u'...' if the string contains an umlaut. I get an exception in django later. But since the exception does not show the string it is hard to find it. Is it possible to loop over all strings the interpreter has parsed?
by: Donn Ingle | last post by:
Hello, I hope someone can illuminate this situation for me. Here's the nutshell: 1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale. 2. If this returns "C" or anything without 'utf8' in it, then things start to go downhill: 2a. The app assumes unicode objects internally. i.e. Whenever there is
by: George Sakkis | last post by:
It seems xml.etree.cElementTree.iterparse() is not unicode aware: .... print elem.text .... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 64, in __iter__ UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-15: ordinal not in range(128)
by: gita ziabari | last post by:
Hello All, The following code does not work for unicode characters: keyword = dict() kw = 'ÇÅÎÓËÉÈ' keyword.setdefault(key, ).append (kw) It works fine for inserting ASCII character. Any suggestion?
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 most users, this new feature is actually very convenient. If you want to control the update process,...
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.