Problem with special characters when saving state to DB

Problem with special characters when saving state to DB

bjarkekrbjarkekr Posts: 6Questions: 2Answers: 0

Hi,

I have a datatables object which contains special characters like "æøå".. The filter on these works on first display of my table. But I also use a function to save the filter as a jason object in the database and when I do that the saved value of æøå gets to be "æøå" in the database.

I do the save so the user doesnt have to do the same filter when he/she returns to the datatable after having browsed other parts of the application.

Any help here would be appreciated.

CODE:

             "stateSaveCallback": function (settings, data) {
                // Send an Ajax request to the server with the state object
                $.ajax( {
                  "url": "egu_eg01.save_table",
                  "data":  { p_data: JSON.stringify(data) },
                  "dataType": "json",
                  "type": "POST",
                  "success": function () {}
                } );


              "stateLoadCallback": function (settings) {
                var o;

                // Send an Ajax request to the server to get the data. Note that
                // this is a synchronous request since the data is expected back from the
                // function
                $.ajax( {
                  "url": "egu_eg01.load_table",
                  "async": false,
                  "dataType": "json",
                  "success": function (json) {

                        o = json;


                   }
                } );

                return o;
              }


Answers

  • bjarkekrbjarkekr Posts: 6Questions: 2Answers: 0

    Noone?

  • allanallan Posts: 61,946Questions: 1Answers: 10,158 Site admin

    It sounds like an issue with the server / database link, so its a little outside the scope of this forum, but it might be worth trying SET NAMES=utf8; in your database setup (assuming you are using MySQL?).

    Allan

This discussion has been closed.