0

In a project we have a form with some input fields and a textarea. It is a multilangual project and if some text is translated in German the use of chars like ü and ö are very common.

In the past we never had problems saving and retrieving these from a database. We use the utf8_general_ci collation in our tables.

Today we got a strange behaviour when submitting the form. All special chars entered in the input fields seem to dissapear.
(They are even gone in $_POST['field_name'], at first we thought it had something to do with codeigniter's input class)

However, any special chars entered in the textarea ARE in the $_POSTarray...

Did anyone have this problem before?

Brainfeeder
  • 2,604
  • 2
  • 19
  • 37
  • 1
    Can you verify that your entire chain is UTF-8? (meta tags, SET NAMES etc.) – Halcyon Sep 25 '13 at 12:35
  • Have you checked the collation of the individual columns in the table. Sometimes it can be set to different to the table. e.g. can you insert characters directly from a database query? If you can then that narrows it down on the input rather than the database. – Robbo_UK Sep 25 '13 at 12:42
  • The individual colums all are the same collation. The meta tags get set depending on the language used at time of pageload. First time I saw this though. Not sure if it needs to be like that, but the dude who worked here before me coded that part. Should I change the meta to utf8 for each language ? – Brainfeeder Sep 25 '13 at 13:49

2 Answers2

0

set meta tag to utf8 or iso-8859-1

<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
ihsan
  • 2,279
  • 20
  • 36
-1

Add header('Content-Type: text/html; charset=utf-8'); to the header

Joran Den Houting
  • 3,149
  • 3
  • 21
  • 51