I'm trying to handle data passed from an HTML form with UTF8 encoding (charset). The data reaches a php page which is suppsed to update a DB table. Before inserting the data into the DB, I would like to check that the form fields were filled out correctly. One of the things I need to check is that text fields do not include special characters. The problem is that the form is filled out in hebrew. The Hebrew characters are transformed into other characters, because of the utf8 encoding, I presume and some of these characters are illegal, as far as I'm concerned. If I leave the text validation out, everything works fine. However, this doesn't seem like a good solution to me. I tried using utf8_decode(), but that doesn't help. It onoly transforms the text into question marks "?????". Does anyone know what could be the problem?
1. have you set the charset type for BOTH the html page with the form on it, and the page receiving the form, by putting this in the pages' <head> section: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> HTML: 2. have you set the charset for the form: <form action="whatever.php" method="post" accept-charset="utf-8"> HTML: That's all I can think of for now.
Thanks for the reply. I'll be sure to set the form's charset. The problem with setting the <head> charset is that setting it for the HTML page is no problem, but setting it for the php is a problem because it is a page that doesn't display anything. It updates the DB and then relocates back to another page. All actions are done on the server side, so there's nothing to display.
have u tried mb_convert_encoding() ? i am not really sure about hebrew character set but have u looked at using a specific charset for hebrew instead of utf-8 ? http://en.wikipedia.org/wiki/ISO_8859-8