my application geting Text from a input field an post it over ajax to a php file for saving it to db.
var title = encodeURIComponent($('#title').val());
if I escape() the title it is all OK but i have Problems with “+” character. So i use the encodeURIComponent().
Now i habe a Problem with german special characters like “ö” “ä” “ü” they will be displayed like a crypdet something….
Have some an idea how can i solve this problem?
Thx
I suppose this has to do with encoding : your HTML page might be using UTF-8, and the special characters are encoded like this :
When your PHP page receives this, it has to know it’s UTF-8, and deal with it as UTF-8 — which means that everything on the server-side has to work with UTF-8 :
For instance, if you are using
var_dump()on the PHP side to display what’s been sent from the client, don’t forget to indicate that the generated page is in UTF-8, with something like this :Else, the browser will use it’s default charset — which is not necessarily the right one, and possibly display garbage.