我正在尝试使用搜索选项对希伯来语网站进行编程。 (旧网站和本网站的字符集是windows-1255) 我在Debian 5(Lenny)上使用php 5.2和Apache 2.2 启用适当的代码页。
我正在使用_POST将参数传递给脚本。如果我通过 英语单词到脚本一切正常,但是当我使用希伯来语时 没有任何东西通过POST功能传递。当我使用ECHO时 要显示_POST,变量为空。
可能是什么问题?
P.S。这是旧网站,在PHP 4上使用debian 4工作正常,问题只出现了 我们升级到PHP5 + debian5后。
答案 0 :(得分:1)
尝试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)
特别是在这种情况下,前两个子弹点。
答案 1 :(得分:1)
谢谢你们,这是我的错。
问题解决了!
我们有一个类过滤器,可以识别php5中的类 并运行
filter_var($this->source[$var], FILTER_SANITIZE_STRING, (FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
这会消除希伯来字符帖子的空白。!