【问题标题】:php POST and non-english language chars passes emptyphp POST 和非英语语言字符传递为空
【发布时间】:2010-03-16 14:07:56
【问题描述】:

我正在尝试编写一个带有搜索选项的希伯来语网站。 (旧站点,该站点的字符集是 windows-1255) 我在 Debian 5 (Lenny) 上使用 php 5.2 和 Apache 2.2 启用适当的代码页。

我正在使用 _POST 将参数传递给脚本。如果我通过 脚本的英文单词一切正常,但是当我使用希伯来语时 POST 函数不会传递任何内容。当我使用 ECHO 显示_POST,变量为空。

可能是什么问题?

附:这是在 PHP 4 和 debian 4 上运行良好的旧网站,问题只是出现了 在我们升级到 PHP5+debian5 之后。

【问题讨论】:

  • 不,该站点使用 windows-1255 运行

标签: php post


【解决方案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)

特别是在这种情况下,前两个子项目符号点。

【讨论】:

    【解决方案2】:

    谢谢大家,是我的错

    问题解决了!

    我们有一个类过滤器可以识别 php5 并运行

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

    这会将希伯来字符帖子清理为空。!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-27
      • 1970-01-01
      • 1970-01-01
      • 2020-12-22
      • 2011-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多