Zend 形式中的英镑符号 (£) 长度或字符集问题?

发布于 2024-12-01 09:22:30 字数 185 浏览 6 评论 0原文

我的密码字段(Zend Form)允许字符串长度为 6,20,

但是当我输入“guru£”(字符串长度 5:fasle)时,它会返回 true,而不会出现 minlenth 错误,并且如果我输入“guru££££”( string length: true) 返回最大长度错误。

任何人都可以帮我重新评级这个吗?提前感谢大师

my password field (Zend Form) is allowing string length 6,20

but When I type "guru£"(string lenth 5:fasle) it is returning true without minlenth error and same time if I type "guru££££" (string length: true) it is return max lenth error.

can any one help me out regrading this one. and Thanks in advance-Guru

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以可爱出名 2024-12-08 09:22:30

您似乎正在使用某种多字节字符编码,可能是 UTF-8。您必须明确告诉 Zend_Validate 以便它正常工作:

$validator->setEncoding("UTF-8");

或者您可以在创建验证器对象时执行此操作:

$validator = new Zend_Validate_StringLength(
    array('min' => 6, 'max' => 20, 'encoding' => 'UTF-8')
);

请参阅 Zend_Validate > Zend Framework 手册中的值编码

You seem to be using some multibyte character encoding, probably UTF-8. You must explicitly tell this to Zend_Validate so that it works correctly:

$validator->setEncoding("UTF-8");

Or you can do it while creating validator object:

$validator = new Zend_Validate_StringLength(
    array('min' => 6, 'max' => 20, 'encoding' => 'UTF-8')
);

See Zend_Validate > Encoding of values in Zend Framework manual.

柳若烟 2024-12-08 09:22:30

您使用 Zend Validation 类吗?

http://framework.zend.com/manual/en/zend.validate .set.html

我认为特别值得注意的是“使用不同语言”部分。

Are you using the Zend Validation class?

http://framework.zend.com/manual/en/zend.validate.set.html

Of particular note is the Using different languages section, I think.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文