Re: [PHP] strlen() gives a wrong count

2002-03-19 Thread Rasmus Lerdorf

Well, how are you putting it into the string?

On Tue, 19 Mar 2002, Gil Disatnik wrote:

 Hello there,

 I have a 98 characters string (including spaces), wc -c says it's 98
 characters and a file containing this string is 98 bytes as well.

 For some reason - strlen() says it's more... it says it's a 104 characters
 strings, when I removed the spaces (using sed on the shell and using
 str_replace on php) - wc said it's 83 characters and strlen() said it's 89...

 How could that be? is there another way to get the exact number of
 characters in a string?

 Thanks.



 Regards

 Gil Disatnik
 UNIX system/security administrator.

 GibsonLP@EFnet

 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 Windows NT has detected mouse movement, you MUST restart
 your computer before the new settings will take effect, [ OK ]
 
 Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
 system, written for a 4 bit processor by a 2 bit company which can
 not stand 1 bit of competition.
 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] strlen() gives a wrong count

2002-03-19 Thread Darren Gamble

Good day,

Could you post this mystery string so that we could help you?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Gil Disatnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 1:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] strlen() gives a wrong count


Hello there,

I have a 98 characters string (including spaces), wc -c says it's 98 
characters and a file containing this string is 98 bytes as well.

For some reason - strlen() says it's more... it says it's a 104 characters 
strings, when I removed the spaces (using sed on the shell and using 
str_replace on php) - wc said it's 83 characters and strlen() said it's
89...

How could that be? is there another way to get the exact number of 
characters in a string?

Thanks.



Regards

Gil Disatnik
UNIX system/security administrator.

GibsonLP@EFnet

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Windows NT has detected mouse movement, you MUST restart
your computer before the new settings will take effect, [ OK ]

Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
system, written for a 4 bit processor by a 2 bit company which can
not stand 1 bit of competition.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] strlen() gives a wrong count

2002-03-19 Thread Gil Disatnik

Of course.
Following is a part Hebrew part English text I have in my phorum, it 
probably won't look good on a system without Hebrew support.

String on a file:
---snip---
îé ùøåöä îåæîð/ú ìëúåá àú ùìå...(àí éù).

370304 - DooG

îäçìåöéí P-:


NP - King Crimson - Beat
---snip---

wc -c testfile says it's 98
sed 's/\ //g' testfile | wc -c says it's 83



The same string on a php variable:
---snip---
$chars=îé ùøåöä îåæîð/ú ìëúåá àú ùìå...(àí éù).

370304 - DooG

îäçìåöéí P-:


NP - King Crimson - Beat;
---snip---
strlen($chars); says 104
strlen(str_replace( ,,$chars)); says 89...


Thank you for the help!


At 13:19 19/03/2002 -0700, Darren Gamble wrote:
Good day,

Could you post this mystery string so that we could help you?


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Gil Disatnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 1:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] strlen() gives a wrong count


Hello there,

I have a 98 characters string (including spaces), wc -c says it's 98
characters and a file containing this string is 98 bytes as well.

For some reason - strlen() says it's more... it says it's a 104 characters
strings, when I removed the spaces (using sed on the shell and using
str_replace on php) - wc said it's 83 characters and strlen() said it's
89...

How could that be? is there another way to get the exact number of
characters in a string?

Thanks.



Regards

Gil Disatnik
UNIX system/security administrator.

GibsonLP@EFnet

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Windows NT has detected mouse movement, you MUST restart
your computer before the new settings will take effect, [ OK ]

Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
system, written for a 4 bit processor by a 2 bit company which can
not stand 1 bit of competition.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Regards

Gil Disatnik
UNIX system/security administrator.

GibsonLP@EFnet

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Windows NT has detected mouse movement, you MUST restart
your computer before the new settings will take effect, [ OK ]

Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
system, written for a 4 bit processor by a 2 bit company which can
not stand 1 bit of competition.
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


RE: [PHP] strlen() gives a wrong count

2002-03-19 Thread Rasmus Lerdorf

Think you could post a base64_encode() version of that string?

On Tue, 19 Mar 2002, Gil Disatnik wrote:

 Of course.
 Following is a part Hebrew part English text I have in my phorum, it
 probably won't look good on a system without Hebrew support.

 String on a file:
 ---snip---
 îé ùøåöä îåæîð/ú ìëúåá àú ùìå...(àí éù).

 370304 - DooG

 îäçìåöéí P-:


 NP - King Crimson - Beat
 ---snip---

 wc -c testfile says it's 98
 sed 's/\ //g' testfile | wc -c says it's 83



 The same string on a php variable:
 ---snip---
 $chars=îé ùøåöä îåæîð/ú ìëúåá àú ùìå...(àí éù).

 370304 - DooG

 îäçìåöéí P-:


 NP - King Crimson - Beat;
 ---snip---
 strlen($chars); says 104
 strlen(str_replace( ,,$chars)); says 89...


 Thank you for the help!


 At 13:19 19/03/2002 -0700, Darren Gamble wrote:
 Good day,
 
 Could you post this mystery string so that we could help you?
 
 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948
 
 
 -Original Message-
 From: Gil Disatnik [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, March 19, 2002 1:12 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] strlen() gives a wrong count
 
 
 Hello there,
 
 I have a 98 characters string (including spaces), wc -c says it's 98
 characters and a file containing this string is 98 bytes as well.
 
 For some reason - strlen() says it's more... it says it's a 104 characters
 strings, when I removed the spaces (using sed on the shell and using
 str_replace on php) - wc said it's 83 characters and strlen() said it's
 89...
 
 How could that be? is there another way to get the exact number of
 characters in a string?
 
 Thanks.
 
 
 
 Regards
 
 Gil Disatnik
 UNIX system/security administrator.
 
 GibsonLP@EFnet
 
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 Windows NT has detected mouse movement, you MUST restart
 your computer before the new settings will take effect, [ OK ]
 
 Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
 system, written for a 4 bit processor by a 2 bit company which can
 not stand 1 bit of competition.
 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Regards

 Gil Disatnik
 UNIX system/security administrator.

 GibsonLP@EFnet

 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 Windows NT has detected mouse movement, you MUST restart
 your computer before the new settings will take effect, [ OK ]
 
 Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit operating
 system, written for a 4 bit processor by a 2 bit company which can
 not stand 1 bit of competition.
 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php