Missing character while saving string?

$userTb = new My_Tb_User(); //Child of Zend_Db_Table_Abstract $row = $userTb->find(9)->current(); $row->name = 'STÖVER'; $row->save(); 

Inside the user table, on line 9, for the value of the column name ST stored instead of STÖVER ?

Ö is a Germanic symbol supported in UTF-8 . IF I manually enter "STÖVER" using phpmyadmin, it will be stored correctly.

I also passed the charset parameter with utf8 when creating the db adapter, but still no luck!

+4
source share
2 answers

Bad practice of using utf8_encode , this adds a lot of complexity to your application. Try to solve the problem by looking for the source.

Doubtful thoughts:

  • a problem with the encoding of the database server (check the encoding of your server)
  • a problem with the encoding of the database client (check the encoding of your connection)
  • a problem with the encoding of the database table (check the encoding of your table)
  • php encoding problem by default (check default_encoding parameter in .ini parameters)
  • multibyte skipped configuration (see mb_string parameters in .ini parameters)
  • a <form> encoding problem (check that it is sent as utf-8)
  • a <html> encoding problem (where enctype is not specified in your html file)
  • a Content-encoding: (where the wrong encoding is sent by Apache).
+2
source

If you read the manual record for utf8_encode , it converts the encoded string ISO-8859-1 to UTF-8. A function name is a terrible misnomer, as it offers some kind of automatic encoding, which is necessary. This is not relevant. If your source code is saved as UTF-8, and you assign "STÖVER" to $string , then $string stores the character "STÖVER" encoded in UTF-8. No further action is required. In fact, an attempt to convert a UTF-8 string (incorrectly) from ISO-8859-1 to UTF-8 will distort it.

 utf8_encode('STÖVER'); 

check this question at fooobar.com/questions/892795 / ...

+3
source

All Articles