unicode characters failing in a mysql database

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

Moderators: Lapo, Bax

Post Reply
eventdave
Posts: 18
Joined: 02 Jul 2010, 14:12

unicode characters failing in a mysql database

Post by eventdave »

I have been trying to write unicode characters into a mysql database but all I see in the database is "???????" where the characters should be.

I found another thread saying you need to change the connection string to tell it to use utf-8 as below

<ConnectionString>jdbc:mysql://server1:3306/myDB?useUnicode=yes&characterEncoding=UTF-8</ConnectionString>

I assume this is changed in the config.xml file?

This causes an error when smartfox starts up, with a whole list of errors about not being able to parse the file.

I think it is down to the "&" character in the string, as if I remove the "&characterEncoding=UTF-8" it then starts smartfox ok, but the "????????" problem is still there.

Am I doing something wrong?

I am using smartfox 1.6.7

I could really do with some help on this one.

Thanks

Dave
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

It might depend on the configuration of your MySQL database or the type of table (so called "collation") that is being used. Please double check that, and in case it doesn't work see if you can upgrade your JDBC driver.
Lapo
--
gotoAndPlay()
...addicted to flash games
eventdave
Posts: 18
Joined: 02 Jul 2010, 14:12

Post by eventdave »

We have now figured it out.

We need t wrap the connection string in a cdata tag.

Hope that helps someone else.
mephi
Posts: 28
Joined: 19 Sep 2010, 16:32

Post by mephi »

Today I had the same problem.
And CDATA works, thanks eventdave!
I also found substituting the & with it's htmlentity & works too! :-)
Not that it matters which way you'll use it :) Just a curios thing!
Post Reply