Page 1 of 1

unicode characters failing in a mysql database

Posted: 05 Jan 2012, 10:27
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

Posted: 05 Jan 2012, 14:29
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.

Posted: 05 Jan 2012, 16:59
by eventdave
We have now figured it out.

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

Hope that helps someone else.

Posted: 10 Feb 2012, 08:20
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!