[Error Log] Empty AJAX responseText + parseError from JSON (MariaDB vs. mySQL)

Hell! I have been struggling on this problem for more than 2 months, and finally got an answer, and that’s related to MariaDB and mySQL. At this stage, I am still confused with whether this is the FINAL and REAL answer.

I am recording the whole process of bug discovery below here, but in a nutshell:

  1. Got empty empty responseText from jQuery AJAX call
  2. Got the parseError from the JQuery AJAX call
  3. Found the source of the error, which is caused by the json_encode function in PHP
  4. Compared the var_dump of the variable being json_encode from mySQL and MariaDB, the output is different
  5. Output frommySQL one has strange character (ASCII code 130), whileMariaDB does not
    • Remind me that mySQL allows the PHP to read and write emoticon from and into the database
    • But, MariaDB does not
    • In conclusion for now, mySQL supports I/O of more unicode characters than MariaDB does (but Asian characters are also supported)
  6. After removing the strange characters from themySQL database, problem solved.
    • Reason is due to the fact that json_encode supports only UTF-8
All string data must be UTF-8 encoded.



WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )


您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s