Results 1 to 2 of 2

Thread: Issue with Chinese characters

  1. #1
    Join Date
    Dec 2011
    Location
    Paris, France
    Posts
    58

    Default Issue with Chinese characters

    Hello,

    I am currently developing a Spring Roo application which will let users input data in Simplified Chinese and Traditional Chinese. I am using Mysql as database.

    I have found an article on the Web (http://www.herongyang.com/PHP-Chines...SQL-UTF-8.html) which explains how to develop a php application to let users input and retrieve Chinese text into/from a MySQL database. Among other things, the article suggest setting the following database sessions variables to utf8: character_set_client, character_set_connection, character_set_database, character_set_results, and character_set_system. Although I have set those variables as suggested, the Simplified Chinese data I input in my Roo application are displayed as garbage when retrieved from the database.

    After rereading the article, I have decided to set the above variables every time the Roo application connects to the database, as shown below (in php):

    mysql_query("SET character_set_client=utf8", $con);
    mysql_query("SET character_set_connection=utf8", $con);

    Unfortunately, I have no idea how to issue those commands in Roo/Hibernate.

    Any suggestions?

    Many thanks.

    Philroc

  2. #2
    Join Date
    Dec 2011
    Location
    Paris, France
    Posts
    58

    Default

    Quote Originally Posted by Philroc View Post
    Hello,

    I am currently developing a Spring Roo application which will let users input data in Simplified Chinese and Traditional Chinese. I am using Mysql as database.

    I have found an article on the Web (http://www.herongyang.com/PHP-Chines...SQL-UTF-8.html) which explains how to develop a php application to let users input and retrieve Chinese text into/from a MySQL database. Among other things, the article suggest setting the following database sessions variables to utf8: character_set_client, character_set_connection, character_set_database, character_set_results, and character_set_system. Although I have set those variables as suggested, the Simplified Chinese data I input in my Roo application are displayed as garbage when retrieved from the database.

    After rereading the article, I have decided to set the above variables every time the Roo application connects to the database, as shown below (in php):

    mysql_query("SET character_set_client=utf8", $con);
    mysql_query("SET character_set_connection=utf8", $con);

    Unfortunately, I have no idea how to issue those commands in Roo/Hibernate.

    Any suggestions?

    Many thanks.

    Philroc
    Issue solved.

    I added

    useUnicode=true&characterEncoding=utf-8

    to the end of the database.url string in database.properties

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •