I have a form which is submitted into a mysql database.
The database is set to UTF-8_GENERAL and the rows are using the same character coding as well.
But when I submit the form with a "ő" or "ű" in the text, it does not submit anything after these characters.
(Example: "This is a nice ű day." It just inserts this into the db: "This is a nice")
The form validation page has the
mysql_real_escape_string();
strip_tags();
before submitting to the db.
How could I solve this?
Any help appreciated...
Its good that you are using mysql_real_escape_string()!
I think the problem might be, that in some side-step form page -> header file -> core file -> mysql macro file -> inserting to DB etc.. If you are using some CMS method of course.
So basically:
- Make sure that all your tables and cells in mysql are UTF8
- Add this to your mysql macro or right after you create mysql connection:
mysql_query("SET NAMES utf8");
- Add this to your core file or on the top of your php page:
Header("Content-Type: text/html; charset=UTF-8");
- And of course the meta-tag, that sets encoding in the html/template file.
If you have mastered those steps, it should be fixed. If not, then at least you have debuged out alot of possible issues :)