Quantcast

Encoding problem with a Grails app. and a MySQL database on Ubuntu

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Encoding problem with a Grails app. and a MySQL database on Ubuntu

bgoetzmann
Hello,

I'm developing a 1.3.5 Grails application that uses a MySQL instance as database.

But I get a strange problem when I deploy my application on a machine under
Ubuntu/Java 6/Tomcat 6/MySQL 5 : all works well except that when the application stores (via a form posted) strings with accented characters, these are badly stored in tables; at display I get then things like Autreééà Ã.

But, if I execute the (same) Grails application on a Window XP machine that accesses the MySQL instance on Ubuntu, all is perfect!!

I tried a lot of things, but without success; for example, I tested an URL data source like:
jdbc:mysql://localhost/gcartdb
or
jdbc:mysql://localhost/gcartdb?useUnicode=true&characterEncoding=UTF-8
But it doesn't resolve my problem.

Any idea, before I go crasy??


Bertrand.





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Encoding problem with a Grails app. and a MySQL database on Ubuntu

bdrhoa
If UTF-8 wasn't selected during the install you can
  • Edit /etc/mysql/my.cnf and add the following two lines under the [mysqld] section (and then restart mysql):

    collation_server=utf8_unicode_ci
    character_set_server=utf8

---------------------------
www.maf.org/rhoads
www.ontherhoads.org


On Tue, Jan 25, 2011 at 3:36 PM, bgoetzmann <[hidden email]> wrote:

Hello,

I'm developing a 1.3.5 Grails application that uses a MySQL instance as
database.

But I get a strange problem when I deploy my application on a machine under
Ubuntu/Java 6/Tomcat 6/MySQL 5 : all works well except that when the
application stores (via a form posted) strings with accented characters,
these are badly stored in tables; at display I get then things like
Autreééà Ã.

But, if I execute the (same) Grails application on a Window XP machine that
accesses the MySQL instance on Ubuntu, all is perfect!!

I tried a lot of things, but without success; for example, I tested an URL
data source like:
jdbc:mysql://localhost/gcartdb
or
jdbc:mysql://localhost/gcartdb?useUnicode=true&characterEncoding=UTF-8
But it doesn't resolve my problem.

Any idea, before I go crasy??


Bertrand.






--
View this message in context: http://grails.1312388.n4.nabble.com/Encoding-problem-with-a-Grails-app-and-a-MySQL-database-on-Ubuntu-tp3237164p3237164.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Encoding problem with a Grails app. and a MySQL database on Ubuntu

bgoetzmann
Thank you for your response!

Finally, I resolve my problem by following this post:

http://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps

I just added:
URIEncoding="UTF-8"

as indicated, in the Tomcat's server.xml file.


;-)

Bertrand.


Loading...