Using "£" symbol in Field causes NULL to be returned in server field.

Using "£" symbol in Field causes NULL to be returned in server field.

PapaLazarouPapaLazarou Posts: 7Questions: 1Answers: 0

Hello,

Just installed Datatables (Im a noob at this) and managed to get the basic server-side processing example working i.e. this one http://datatables.net/examples/server_side/simple.html

However Ive come across a strange problem that whenever one of my fields has a "£" symbol I got NULL back from the server just in that field. Same goes for some content which has Javascript tags.

Anyone offer any help.

Regards

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,832Questions: 1Answers: 10,133 Site admin

    Sounds like a character encoding issue. I would suggest making sure that the DB is UTF8, the communication between your PHP (or whatever you used) and the DB is UTF8 and the character encoding for the page is UTF8.

    If you don't want UTF8 then as long as you are consistent it should work.

    Allan

  • PapaLazarouPapaLazarou Posts: 7Questions: 1Answers: 0

    Well I checked and set everything to UTF8 but still the field will be NULL if it encounters a "£" symbol in it.

    Also if the field contains ¬ then it will also be null.

    Anyone have any suggestions ?

    Cheers.

  • allanallan Posts: 61,832Questions: 1Answers: 10,133 Site admin
    Answer ✓

    Could you try executing the following SQL queries against the database before the script makes its queries to get the data:

    SET character_set_client=utf8;
    SET character_set_connection=utf8;
    SET character_set_results=utf8;
    

    Allan

  • PapaLazarouPapaLazarou Posts: 7Questions: 1Answers: 0

    Hi Allan,

    Yes looks like your right it is some encoding issue. After playing around with things I got the field to show up but the pound signs show as square blocks and I have to manually change them.

    Cheers.

This discussion has been closed.