Re: AW: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-16 Thread Jan Pieper
-BEGIN PGP SIGNED MESSAGE-
Hash: RIPEMD160

 -Original Message-
 From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
 (iconv is used already in a number of components -- XmlRpc, 
 Lucene, Mime, and likely some others.)
 
 Also I found iconv used in Zend_Pdf, and a few of the web services.  So
 yes, it is certainly fair to use it.
 
 We now have an appendix in the manual that lists ZF components that use
 each respective PHP extension (the the best of my ability to discover
 this information).  Also thanks to Thomas for creating the reverse
 table, PHP extensions used by each respective ZF component.
 
 Bill Karwin
 

Hmm JIRA is still down, so I could not look into the open issue regards
to this discussion.

You are talking about using getting string length by iconv or mb_string
instead of using strlen() because it can't handle chinese (multibyte)
characters. Both extensions are optional so why we can't check for
loaded extension and decide what to use?

Default: strlen
iconv loaded:iconv_strlen
mb_string loaded:mb_strlen
Both ext loaded: Don't know if there are any advantages or
 disadvantages on any extension (iconv/mb_string)

- -- Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFG7O1fd3s9o1H9MZ4RA48KAJ0csidhYmfVEKjBWkvDT6NGuvXYlgCbBpUU
+pkuBK6Xin4GVMaHK/4wO5Q=
=gOIZ
-END PGP SIGNATURE-


AW: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-13 Thread Leo Büttiker
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] 



Re: AW: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-13 Thread Pádraic Brady
I don't think you can class it as a bug. The problem is that both extensions 
are optional (except for Windows where iconv had to be built in) so it's 
difficult to rely on them for something as common as string length validation.

Until PHP6 pops up, I'd suggest creating a subclass which substitutes 
mb_strlen() and ensure ext/mbstring is available for your environment. Maybe it 
could be suggested someone add an optional Zend_Validate_MultiByteStringLength 
or similar which can mediate across iconv/mbstring and accept an optional 
encoding parameter?
 
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com


- Original Message 
From: Leo Büttiker [EMAIL PROTECTED]
To: mikespook [EMAIL PROTECTED]; Zend Framework General 
fw-general@lists.zend.com; Maarten Manders | tilllate AG [EMAIL PROTECTED]
Sent: Thursday, September 13, 2007 7:44:51 AM
Subject: AW: [fw-general] The validation of StringLength can't be used with 
Chinese

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] 








   

Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting 

Re: AW: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-13 Thread mikespook
As far as I know, the Zend_Search_Lucene has already used the iconv
extension.
So, I don't think using the iconv ext will be a problem for us.


在07-9-13,Pádraic Brady [EMAIL PROTECTED] 写道:

 I don't think you can class it as a bug. The problem is that both
 extensions are optional (except for Windows where iconv had to be built in)
 so it's difficult to rely on them for something as common as string length
 validation.

 Until PHP6 pops up, I'd suggest creating a subclass which substitutes
 mb_strlen() and ensure ext/mbstring is available for your environment. Maybe
 it could be suggested someone add an optional
 Zend_Validate_MultiByteStringLength or similar which can mediate across
 iconv/mbstring and accept an optional encoding parameter?

 Pádraic Brady
 http://blog.astrumfutura.com
 http://www.patternsforphp.com


 - Original Message 
 From: Leo Büttiker [EMAIL PROTECTED]
 To: mikespook [EMAIL PROTECTED]; Zend Framework General 
 fw-general@lists.zend.com; Maarten Manders | tilllate AG 
 [EMAIL PROTECTED]
 Sent: Thursday, September 13, 2007 7:44:51 AM
 Subject: AW: [fw-general] The validation of StringLength can't be used
 with Chinese

 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]



 --
 Looking for a deal? Find great prices on flights and 
 hotelshttp://us.rd.yahoo.com/evt=47094/*http://farechase.yahoo.com/;_ylc=X3oDMTFicDJoNDllBF9TAzk3NDA3NTg5BHBvcwMxMwRzZWMDZ3JvdXBzBHNsawNlbWFpbC1uY20-with
  Yahoo! FareChase.




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


Re: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-13 Thread Nico Edtinger
According to the wiki iconv is enabled by default/included in all  
supported PHP versions. It's also used in Zend_Mime_Decode.


nico

Pádraic Brady wrote:
I'll check iconv's status if no one else replies - looks like the  
Wiki and Jira are currently offline but if iconv is an acceptable  
standard extension as a dependency then maybe such a validator  
could be proposed as an improvement.


P

Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com


- Original Message 
From: mikespook [EMAIL PROTECTED]
To: Pádraic Brady [EMAIL PROTECTED]
Cc: Leo Büttiker [EMAIL PROTECTED]; Zend Framework  
General fw-general@lists.zend.com

Sent: Thursday, September 13, 2007 10:25:35 AM
Subject: Re: AW: [fw-general] The validation of StringLength can't  
be used with Chinese


As far as I know, the Zend_Search_Lucene has already used the iconv  
extension.


So, I don't think using the iconv ext will be a problem for us.


在07-9-13,Pádraic Brady [EMAIL PROTECTED]

写道:
I don't think you can class it as a bug. The problem is that both  
extensions are optional (except for Windows where iconv had to be  
built in) so it's difficult to rely on them for something as common  
as string length validation.



Until PHP6 pops up, I'd suggest creating a subclass which  
substitutes mb_strlen() and ensure ext/mbstring is available for  
your environment. Maybe it could be suggested someone add an  
optional Zend_Validate_MultiByteStringLength or similar which can  
mediate across iconv/mbstring and accept an optional encoding  
parameter?



Pádraic Brady

http://blog.astrumfutura.com

http://www.patternsforphp.com



- Original Message 
From: Leo Büttiker [EMAIL PROTECTED]
To: mikespook 
[EMAIL PROTECTED]; Zend Framework General 
fw-general@lists.zend.com; Maarten Manders | tilllate AG  
[EMAIL PROTECTED]


Sent: Thursday, September 13, 2007 7:44:51 AM
Subject: AW: [fw-general] The validation of StringLength can't be  
used with Chinese


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]









  Looking for a deal?
Find great prices on flights and hotels with Yahoo! FareChase.




--
广州市一方信息咨询有限公司
地址:广州市 江南大道中 穗花村 三巷12号204
邮编:510245
电话:020-39738561 020-39738571

传真:020-84476279
网站:www.i-fang.com
[EMAIL PROTECTED]







__ 
__
Be a better Heartthrob. Get better relationship answers from  
someone who knows. Yahoo! Answers - Check it out.

http://answers.yahoo.com/dir/?link=listsid=396545433




Re: AW: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-13 Thread Matthew Weier O'Phinney
-- Pádraic Brady [EMAIL PROTECTED] wrote
(on Thursday, 13 September 2007, 02:45 AM -0700):
 I'll check iconv's status if no one else replies 

The rule of thumb is that if the extension is enabled in a vanilla build
of PHP, it's fair game (that, or if the functionality clearly notes that
it requires a specific extension -- e.g., one of the Zend_Db adapters).
iconv falls into the vanilla PHP category, while mbstring does not.

(iconv is used already in a number of components -- XmlRpc, Lucene,
Mime, and likely some others.)


 - Original Message 
 From: mikespook [EMAIL PROTECTED]
 To: P  draic Brady [EMAIL PROTECTED]
 Cc: Leo B  ttiker [EMAIL PROTECTED]; Zend Framework General
 fw-general@lists.zend.com
 Sent: Thursday, September 13, 2007 10:25:35 AM
 Subject: Re: AW: [fw-general] The validation of StringLength can't be used 
 with
 Chinese
 
 As far as I know, the Zend_Search_Lucene has already used the iconv extension.
 So, I don't think using the iconv ext will be a problem for us.
 
 
   07-9-13  P  draic Brady [EMAIL PROTECTED]  д
 
 I don't think you can class it as a bug. The problem is that both
 extensions are optional (except for Windows where iconv had to be built 
 in)
 so it's difficult to rely on them for something as common as string length
 validation.
 
 Until PHP6 pops up, I'd suggest creating a subclass which substitutes
 mb_strlen() and ensure ext/mbstring is available for your environment.
 Maybe it could be suggested someone add an optional
 Zend_Validate_MultiByteStringLength or similar which can mediate across
 iconv/mbstring and accept an optional encoding parameter?
  
 P  draic Brady
 http://blog.astrumfutura.com
 http://www.patternsforphp.com
 
 
 - Original Message 
 From: Leo B  ttiker [EMAIL PROTECTED]
 To: mikespook  [EMAIL PROTECTED]; Zend Framework General 
 fw-general@lists.zend.com; Maarten Manders | tilllate AG 
 [EMAIL PROTECTED]
 Sent: Thursday, September 13, 2007 7:44:51 AM
 Subject: AW: [fw-general] The validation of StringLength can't be used 
 with
 Chinese
 
 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]
 
 
 
 
 ━━━
 Looking for a deal? Find great prices on flights and hotels with Yahoo!
 FareChase.
 
 
 
 
 --
 Ϣ  ѯ  ˾
12  204
ࣺ510245
  绰  020-39738561 020-39738571
   020-84476279
   վ  www.i-fang.com
   [EMAIL PROTECTED]
 
 
 ━━━
 Be a better Heartthrob. Get better relationship answers from someone who 
 knows.
 Yahoo! Answers - Check it out.

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


RE: AW: [fw-general] The validation of StringLength can't be used with Chinese

2007-09-13 Thread Bill Karwin
 -Original Message-
 From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
 (iconv is used already in a number of components -- XmlRpc, 
 Lucene, Mime, and likely some others.)

Also I found iconv used in Zend_Pdf, and a few of the web services.  So
yes, it is certainly fair to use it.

We now have an appendix in the manual that lists ZF components that use
each respective PHP extension (the the best of my ability to discover
this information).  Also thanks to Thomas for creating the reverse
table, PHP extensions used by each respective ZF component.

Bill Karwin


[fw-general] The validation of StringLength can't be used with Chinese

2007-09-12 Thread mikespook
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]