UTF8 db encoding

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

UTF8 db encoding

Postby corwin » 21 Jun 2010, 14:52

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?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 22 Jun 2010, 07:49

The problem is not in the DBManager, you should double check your database tables and DB config and make sure that UTF-8 support is enabled
Lapo
--
gotoAndPlay()
...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 22 Jun 2010, 08:00

Believe me, I pentachecked them. :) Coalition is utf8_general_ci, and when I insert from phpmyadmin/console/php, cyrilic is ok.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 22 Jun 2010, 08:06

Do cyrillic symbols work in the chat, for example?
Lapo

--

gotoAndPlay()

...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 22 Jun 2010, 08:41

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.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 22 Jun 2010, 09:19

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.
Lapo

--

gotoAndPlay()

...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 22 Jun 2010, 09:22

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...
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 24 Jun 2010, 05:04

Me neither, and I've had similar issues too, but usually it always depend on that.

Glad that it's now solved

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 30 guests