UTF8 db encoding
UTF8 db encoding
When I try to insert into mysql table using java DbManager and have cyrillic symbols in one of the vars I get ???? in the database. When I try "SET NAMES utf8" nothing changes - I guess it works just for the current connection, so how can I set it for the whole database manager?
Yes, they work ok, problem is only when inserting into db using DbManager.
Example from my code:
this.sender = "123";
this.reciever = "123";
this.message = "блах";
this.dbManager.executeCommand("INSERT INTO offline_messages SET"
+ " sender = '" + this.sender
+ "', message = '" + this.message
+ "', reciever = '" + this.reciever
+ "', date = NOW()"
);
P.S. Of course in my real code I get this.message from other database, where it is inserted ok with php, but both this example and real code doesn't work.
Example from my code:
this.sender = "123";
this.reciever = "123";
this.message = "блах";
this.dbManager.executeCommand("INSERT INTO offline_messages SET"
+ " sender = '" + this.sender
+ "', message = '" + this.message
+ "', reciever = '" + this.reciever
+ "', date = NOW()"
);
P.S. Of course in my real code I get this.message from other database, where it is inserted ok with php, but both this example and real code doesn't work.
Unfortunately I don't know how to help. We have other customers who problems very similar to this one and they all solved it from the database side, not SmartFox.
The only problem with SmartFox could be if it didn't recognize the characters, for example in the chat as I said. But if that works the problems is very likely to be outside.
The only problem with SmartFox could be if it didn't recognize the characters, for example in the chat as I said. But if that works the problems is very likely to be outside.
Ok, thanks, when resolve the problem will post...
===================
Edit:
Ok, you were completely right. When I typed SHOW VARIABLES, I saw the following:
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
My DB and tables where set to utf_general_ci, but I guess all that matters is character_set_server - when set it to utf8 into the ini file, everything works ok... I have no explanation why it worked with php and phpadmin...
===================
Edit:
Ok, you were completely right. When I typed SHOW VARIABLES, I saw the following:
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
My DB and tables where set to utf_general_ci, but I guess all that matters is character_set_server - when set it to utf8 into the ini file, everything works ok... I have no explanation why it worked with php and phpadmin...
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 30 guests