tags:

views:

40

answers:

2

I'm trying to program a Hebrew site with a search option. (old site and the charset of this site is windows-1255) I am using php 5.2 with Apache 2.2, on a Debian 5 (Lenny) with appropriate code pages enabled.

I am using _POST to pass arguments to a script. If I pass English word to the script everything works, but when I use Hebrew nothing is passed through the POST function. When I use ECHO to show _POST, the variable is empty.

What might be the problem?

P.S. this is old site that worked fine on PHP 4 with debian 4, and the problem arised only after we upgrade to PHP5+debian5.

+1  A: 

Try the tips under "Programming Considerations" of this article:

*  Explicit use of UTF-8, marked with
      o "mb_language('uni'); mb_internal_encoding('UTF-8');" at the top of your scripts
      o Content-type: text/html; charset=utf-8 in the HTTP header, by way of .htaccess, header() or Web server configuration
      o <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> and <orm accept-charset = "utf-8"> in HTML markup
      o CREATE DATABASE ... DEFAULT CHARACTER SET utf8 COLLATE utf8 ... ENGINE ... CHARSET=utf8 COLLATE=utf8_unicode_ci is a typical sequence for a MySQL instance, with comparable expressions for other databases
      o SET NAMES 'utf8' COLLATE 'utf8_unicode_ci' is a valuable directive for PHP to send MySQL immediately after connecting
      o In php.ini, assign default_charset = UTF-8
* Replacement of string functions, such as strlen and strtlower, with mb_strlen and mb_convert_case
* Replacement of mail and colleagues with mb_send_mail, etc.; while Unicode-aware e-mail is an advanced topic beyond the scope of this introduction, the use of mb_send_mail is a good starting point
* Use of multibyte regular expressions functions (see Resources)

Especially, in this case, the first two sub-bullet points.

Ricket
+1  A: 

thanks guys , its my fault

the problem solve !

we have a class filter that recognize that is in php5 and run

filter_var($this->source[$var], FILTER_SANITIZE_STRING, (FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));

and this sanitize the hebrew chars post to empty .!

Haim Evgi