In my point of view this might be a bug in the Zend Framework. It would be 
great if you can send a patch to the mailinglist, some zend guys might be able 
to put the patch in the next realase.

________________________________________
Von: mikespook [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 13. September 2007 04:00
An: Zend Framework General
Betreff: [fw-general] The validation of StringLength can't be used with Chinese

Hi, all,

The method "isValid" in the class Zend_Validate_StringLength, is look like this 
:

    public function isValid($value)
    {
        $valueString = (string) $value;
        $this->_setValue($valueString); 
        $length = strlen($valueString);
        if ($length < $this->_min) {
            $this->_error(self::TOO_SHORT);
        }
        if (null !== $this->_max && $this->_max < $length) { 
            $this->_error(self::TOO_LONG);
        }
        if (count($this->_messages)) {
            return false;
        } else {
            return true;
        }
    }


the line: $length = strlen($valueString); get $valueString's lenght.But it 
didn't work with Chinese or any other mutil-char languages( eg. CKJ ).

so, what about using iconv_strlen or mb_strlen instead of the function strlen?

-- 
广州市一方信息咨询有限公司
地址:广州市 江南大道中 穗花村 三巷12号204 
邮编:510245 
电话:020-39738561 020-39738571
传真:020-84476279
网站:www.i-fang.com
[EMAIL PROTECTED] 

Reply via email to