aaData return NULL when there are special characters åäö

aaData return NULL when there are special characters åäö

peterpanpeterpan Posts: 4Questions: 0Answers: 0
edited March 2012 in General
Hi,

I have a problem when using the example code for server side processing.

All instances from the table in the databadse with characters 'åäö' is being replaced with null in aaData array for output. The result is being that the Info with 'åäö' is not showing in the table.


The aaData array:
"aaData":[["1","Maria","Norling","680410"],["2","Daniel ",null,"7504015"]]}


The database:
1 Maria Norling 680410
2 Daniel Zetterström 750401

Does anyone have a solution for this?

/P

Replies

  • peterpanpeterpan Posts: 4Questions: 0Answers: 0
    Hi all again,

    I have solved the problem myself and i thaught I posted it if anyone else would have same issues.

    UTF-8 encode the output.

    Change:
    $row[] = $aRow[ $aColumns[$i] ];

    To:
    $row[] = utf8_encode($aRow[ $aColumns[$i] ]);


    Please post any other solution that is more simple than this. One where you dont need to encode all of your output.

    /P
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Can you not just read it from the database as UTF8? This post might be of interest: http://datatables.net/forums/discussion/675/failed-to-search-server-side-data-utf8/p1#Item_4

    Allan
This discussion has been closed.