MySQL Forums
Forum List  »  Connector/C++

character set
Posted by: Freek Bou
Date: May 18, 2010 04:33AM

Hi,

I'm relatively new to mysql and the Connector/C++.
I'm using MySQL 5.1.45 with MySQL Connector C++ 1.0.5. I do compile under VC++.

I've created with no options database: d;
I've created a table with no options: t with only field f varchar(1);

I've created my program as follows:
string SQL = "INSERT INTO T1(f) VALUES(?)";
prep_stmt = con -> prepareStatement (SQL);
prep_stmt -> setString (1, "e");
int updatecount = prep_stmt -> executeUpdate();

And it works great.
Then I change
prep_stmt -> setString (1, "é"); // E with an accent...
and the execute update fails.

if I start the mysql prompt and do the insert statement it works fine.

Windows is using the latin1 characterset and mysql is using utf, so... I tried to change my table to use latin1, but still it fails.

Since I don't have to tell mysql what my characterset is when I connect, I think it expects unicode.

But I hope that I can tell in my C++ program that the data it get's is latin1 and that the table remains unicode. If not has anyone any idea on what is the best approach in this?

Thanks in advance,
Freek

Options: ReplyQuote


Subject
Views
Written By
Posted
character set
3538
May 18, 2010 04:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.