-1

Well, as a Webdeveloper, german language sucks.

I have a from. In the head, there is at the first place:

<meta charset="utf-8">

I also checked the header. The following is set:

Content-Type:text/html; charset=UTF-8

In php.ini my default-charset is:

default_charset="utf-8"

The problem is in HTML/PHP because when I write Umlauts (äöü) directly in the database, PHP gets the right string, when I var_dump it. On the other side when I fill out the textarea and send the form, the var_dump for the POST-Parameter has everytime 2 questionmarks instead of the Umlauts.

ä -> ??

How can I fix it?

pestKater
  • 1
  • 1

1 Answers1

-1

I despair, so I added some Javascript, which replace the Umlauts in the Textbox-Value until the form is sending.

$('form').submit( function(ev) {
var textarea = $('form textarea');
var text = textarea.val();

   text = text.replace(/ä/g,"&auml;");
   text = text.replace(/ö/g, '&ouml;');
   text = text.replace(/ü/g, '&uuml;');
   text = text.replace(/Ä/g, '&Auml;');
   text = text.replace(/Ö/g, '&Ouml;');
   text = text.replace(/Ü/g, '&Uuml;');
   text = text.replace(/ß/g, '&szlig;');

   textarea.val(text);
});

In PHP I use html_entity_decode to write the data in the database.

    $sql_arr = array(
       'descr'     =>  html_entity_decode($db->sql_escape($request->variable('description', ''))),
       // Some more Data
    );
pestKater
  • 1
  • 1