php - strange character inserted in table utf8 -
i have site developed in codeigniter i'd insert record inside database in table utf8 fields.
problem when insert inside table see that:
�"�h�t�t�p�:�/�/�i�m�a�g�e�1�.�u�r�l�f�o�r�i�m�a�g�e�s�.�c�o�m�/�d�e�f�a�u�l�t�/�8�8�0�4�/�2�3�6�9�2�2�6�2�-�1�8�4�3�3�8�5�2�6�6�.�j�p�g�"�
there many more characters. real string simple path. don't know format of string because external server.
this query insert record. take string xml , if print inside page see correct string. problem occurs whenever check inside database:
foreach($img->childnodes $node){ $data = array( 'image'=>$node->getattribute('path'), ); $this->db->insert('hotel_images',$data); }
that data not utf-8. ucs-2 or utf-16. ucs-2 subset of utf-16, treating utf-16 should trick.
you can convert using iconv.
$data = iconv("utf-16", "utf-8", $data);
Comments
Post a Comment