Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Japanese PHP

Options
  • 15-12-2006 1:02pm
    #1
    Registered Users Posts: 59 ✭✭


    Hi all,

    I already stuck this on the mysql forums, but no reply yet......so here goes...

    I have a php5.x mysql 5.0.x - I have a page doing a simple POST or GET.

    I insert some text into the text box, it posts it back to the same page and writes it to both a file and a database. It comes out ok in the file, and I can retrieve it fine back from the database. My page encoding is UTF-8

    Problem is when I look at it in the DB it uses the scrambled characters as opposed to the proper ones.

    Now I know this can be done with my existing setup as phpmyadmin can insert the characters I want using the insert page.

    I am wondering how I can store the proper characters in the DB and show them properly on the webpage.

    Any help is appreciated.

    I did see this in the mysql forums:

    "mysql_query( "SET NAMES utf8", $database_connection );
    mysql_query( "SET CHARACTER SET utf8", $database_connection ); "

    But I think I can retrieve ok, its just not stored properly in the DB once its in inserted.

    Cmo


Comments

  • Closed Accounts Posts: 119 ✭✭frodo_dcu


    In phpmyadmin in field your storing the info in, change the Collation value to the correct version of uft8 for japanese ... I think will fix your problem also make sure browser is using the correct Char set


  • Registered Users Posts: 59 ✭✭cmo


    This was indeed the problem

    mysql_query( "SET NAMES utf8", $database_connection );
    mysql_query( "SET CHARACTER SET utf8", $database_connection );

    That made it appear correctly on insertion in the db and on retrieval ....... I don't know exactly what this does, as you have to do it every connection you make to the DB for the inserts etc to work.


Advertisement