2

I have mobile application working on HTML5 under Android. User can text message using standard <textarea /> and this will send by $.post() function. Then my PHP script serialize message and put it to MySQL using Zend library. What I have now: 1000 messages are ok and 26 messages are stored truncated in DB. All messages on Russian language. F.e.:

a:3:{s:11:"show_telnum";s:6:"author";s:8:"show_gps";s:3:"all";s:7:"message";s:39:"Интересная штука

a:3:{s:11:"show_telnum";s:6:"author";s:8:"show_gps";s:6:"author";s:7:"message";s:18:"Канечна

a:3:{s:11:"show_telnum";s:6:"author";s:8:"show_gps";s:6:"author";s:7:"message";s:34:"Ну будем знакомы

So this is completed word(s) and then data just truncated. I really have no idea what's goind on, because all Russian text is handled right. In Zend config array I have settled option 'charset' => 'UTF8', Please, any suggestions?

2 Answers2

0

This should not be an answer, but it was too long for a readable comment:

Like you mentioned, I really think that the problem is some character, which can not properly be encoded. MySQL truncates at this point, maybe you can find out which character this is.

Comes that Input from an utf-8 document and the database is using utf-8 charset and collation?

Have you tried SHOW WARNINGS in your Database?

You can also try to save the array as a BLOB in your database, you might have less problems.

var_dump() the serialized string to see if it's OK.

What you can try to is base64_encode/base_64_decode just for testing.

// serialize
$stringToStore = base64_encode( serialize( $your_string ) );

//to unserialize...
$arrayFromStringStoredInDB = unserialize( base64_decode( $your_db_string ) );
swidmann
  • 2,787
  • 1
  • 18
  • 32
0

Ok, here is the full answer: How to insert utf-8 mb4 character(emoji in ios5) in mysql? Also, in Zend I have to modify config 'charset' => 'utf8mb4' and now is all works great.

P.S. Just a smile can kill a part of data in utf8 row!!! What a hell???

Community
  • 1
  • 1