On 06/20/2011 10:25 AM, John Crenshaw wrote:
Doing this with an explicit iterator object is a fine idea. The syntax
becomes something like:
foreach(new TextIterator($s, 'UTF8') as $pos=$c)
{
...
}
On the other hand, I think that trying to support iteration without using an
iterator
Zitat von Larry Garfield la...@garfieldtech.com:
On 06/20/2011 10:25 AM, John Crenshaw wrote:
Doing this with an explicit iterator object is a fine idea. The
syntax becomes something like:
foreach(new TextIterator($s, 'UTF8') as $pos=$c)
{
...
}
On the other hand, I think that trying
-Original Message-
From: Jan Schneider [mailto:j...@horde.org]
And if that very same string that's supposed to be an array is
processed using the $var[$n] syntax nowadays is any different? It's
not, you won't get an error message for that either, and it's the same
amount of
Am 22.06.2011 07:24, schrieb Tomas Kuliavas:
2011.06.21 23:27 Reindl Harald rašė:
i do not understand any word and miss a simple str_is_utf8()
Such function uses six lines in PHP.
so why do you not post them?
You can write your own.
no i can not as said
I need locale insensitive
Em Wed, 22 Jun 2011 12:14:40 +0100, Reindl Harald h.rei...@thelounge.net
escreveu:
Am 22.06.2011 07:24, schrieb Tomas Kuliavas:
2011.06.21 23:27 Reindl Harald rašė:
i do not understand any word and miss a simple str_is_utf8()
Such function uses six lines in PHP.
so why do you not post
Am 22.06.2011 14:14, schrieb Gustavo Lopes:
Em Wed, 22 Jun 2011 12:14:40 +0100, Reindl Harald h.rei...@thelounge.net
escreveu:
Am 22.06.2011 07:24, schrieb Tomas Kuliavas:
2011.06.21 23:27 Reindl Harald rašė:
i do not understand any word and miss a simple str_is_utf8()
Such function uses
2011/6/22 Reindl Harald h.rei...@thelounge.net:
WTF should this do?
this won't return boolean
It's an expression, so its evaluated result is a boolean hence why it
makes sense
--
regards,
Kalle Sommer Nielsen
ka...@php.net
--
PHP Internals - PHP Runtime Development Mailing List
To
Em Wed, 22 Jun 2011 13:21:10 +0100, Reindl Harald h.rei...@thelounge.net
escreveu:
Am 22.06.2011 14:14, schrieb Gustavo Lopes:
It's actually 3 lines:
function str_is_utf8($str) {
return $str == || htmlspecialchars($str, 0, UTF-8);
}
WTF should this do?
this won't return boolean
Am 22.06.2011 15:30, schrieb Gustavo Lopes:
Em Wed, 22 Jun 2011 13:21:10 +0100, Reindl Harald h.rei...@thelounge.net
escreveu:
Am 22.06.2011 14:14, schrieb Gustavo Lopes:
It's actually 3 lines:
function str_is_utf8($str) {
return $str == || htmlspecialchars($str, 0, UTF-8);
}
Am 22.06.2011 15:40, schrieb Reindl Harald:
and why this will not return true if $str is ISO-8859-1?
If you RTFM (in your jargon) you would know.
http://ch.php.net/manual/en/function.htmlspecialchars.php (Return value
Section)
--
PHP Internals - PHP Runtime Development Mailing List
To
and why this will not return true if $str is ISO-8859-1?
For lower 7 bit characters (code points = 127) it would return true.
But if there is a single higher character (outside of ascii), it would
only return true if the byte sequences follow UTF-8 semantics. So it
would return false if
Am 22.06.2011 15:45, schrieb Lars Schultz:
Am 22.06.2011 15:40, schrieb Reindl Harald:
and why this will not return true if $str is ISO-8859-1?
If you RTFM (in your jargon) you would know.
http://ch.php.net/manual/en/function.htmlspecialchars.php (Return value
Section)
i read the
Please change your tone.
Thank you.
Olivier
--
http://www.olivierhill.ca/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On 06/22/2011 06:52 AM, Reindl Harald wrote:
Am 22.06.2011 15:45, schrieb Lars Schultz:
Am 22.06.2011 15:40, schrieb Reindl Harald:
and why this will not return true if $str is ISO-8859-1?
If you RTFM (in your jargon) you would know.
Am 22.06.2011 15:55, schrieb Olivier Hill:
Please change your tone.
Thank you
the tonhe is quite correct for peopole who think a quick 3 liner will do
the job of UTF8 detection which it does not and there you can read the manual
as often you want
signature.asc
Description: OpenPGP
Am 22.06.2011 15:57, schrieb Rasmus Lerdorf:
There is obviously no way to tell if hello is UTF-8 or ISO-8859-1. It
is technically impossible since the two are identical in that range.
yes and so this will not work
and as long PHP has on million places troubles with UTF8 it would
be hardly
On 06/22/2011 07:01 AM, Reindl Harald wrote:
Am 22.06.2011 15:57, schrieb Rasmus Lerdorf:
There is obviously no way to tell if hello is UTF-8 or ISO-8859-1. It
is technically impossible since the two are identical in that range.
yes and so this will not work
and as long PHP has on
Am 22.06.2011 16:06, schrieb Rasmus Lerdorf:
On 06/22/2011 07:01 AM, Reindl Harald wrote:
Am 22.06.2011 15:57, schrieb Rasmus Lerdorf:
There is obviously no way to tell if hello is UTF-8 or ISO-8859-1. It
is technically impossible since the two are identical in that range.
yes and so
On Wed, Jun 22, 2011 at 4:08 PM, Reindl Harald h.rei...@thelounge.netwrote:
Am 22.06.2011 16:06, schrieb Rasmus Lerdorf:
On 06/22/2011 07:01 AM, Reindl Harald wrote:
Am 22.06.2011 15:57, schrieb Rasmus Lerdorf:
There is obviously no way to tell if hello is UTF-8 or ISO-8859-1. It
Am 22.06.2011 16:49, schrieb Ferenc Kovacs:
after 10 years i want solutions where it is not the road to hell using any
string function on user-input and since PHP6 seems to be quite dead
it feels there will never be a trustable solution
you made my day.
boy :)
after fetch a
On Wed, Jun 22, 2011 at 4:52 PM, Reindl Harald h.rei...@thelounge.netwrote:
Am 22.06.2011 16:49, schrieb Ferenc Kovacs:
after 10 years i want solutions where it is not the road to hell
using any
string function on user-input and since PHP6 seems to be quite dead
it feels
1. The number of CHARs isn't unrelevant in a general manner.
It depents on the application, even if the trend goes towards UTF8 for
websites.
2. Within 10 years, you could have come to a working solution which could
please us all.
3. Stop flaming and focus on your other day-job instead.
FIRST:
it is terrible that one post in HTML, the next ansers on top
and other answering on bottom in the same thread and that the
most do not undertsand reply to the list address is enough
Am 22.06.2011 17:07, schrieb Robert Eisele:
1. The number of CHARs isn't unrelevant in a general manner
On Wed Jun 22 11:25 AM, Reindl Harald wrote:
and php as primary web-language is missing UTF8 support in the core
You have a valid point.
Now onto foreach() for strings, any other opinions?
Seems like the discussion is closed and most likely should move to a RFC
with some consideration about
2011.06.22 14:14 Reindl Harald rašė:
Am 22.06.2011 07:24, schrieb Tomas Kuliavas:
2011.06.21 23:27 Reindl Harald rašė:
i do not understand any word and miss a simple str_is_utf8()
Such function uses six lines in PHP.
so why do you not post them?
My lines are not public domain. They are
On Mon, 20 Jun 2011, Stas Malyshev wrote:
On 6/20/11 9:15 AM, John Crenshaw wrote:
From: Ilia Alshanetsky [mailto:i...@prohost.org]
As long as it works on a premise that a string is a byte array
and each element represents 1 byte, +1 from me.
Code written on this premise is
On Tue, Jun 21, 2011 at 12:53 PM, Derick Rethans der...@php.net wrote:
It depended on ICU there, and I would be against making a core thing in
PHP 5.x depend on ICU.
It can and should be done as part of intl, actually.
But that's somehow unrelated to the proposal here, as it is about
byte,
Pierre Joye wrote:
It depended on ICU there, and I would be against making a core thing in
PHP 5.x depend on ICU.
It can and should be done as part of intl, actually.
But that's somehow unrelated to the proposal here, as it is about
byte, not characters :)
I believe this may be where some
On Tue, Jun 21, 2011 at 1:33 PM, Lester Caine les...@lsces.co.uk wrote:
Pierre Joye wrote:
It depended on ICU there, and I would be against making a core thing in
PHP 5.x depend on ICU.
It can and should be done as part of intl, actually.
But that's somehow unrelated to the proposal
Pierre Joye wrote:
On Tue, Jun 21, 2011 at 1:33 PM, Lester Caineles...@lsces.co.uk wrote:
Pierre Joye wrote:
It depended on ICU there, and I would be against making a core thing in
PHP 5.x depend on ICU.
It can and should be done as part of intl, actually.
But that's somehow unrelated
Pierre Joye wrote:
On Tue, Jun 21, 2011 at 1:33 PM, Lester Caineles...@lsces.co.uk wrote:
Pierre Joye wrote:
It depended on ICU there, and I would be against making a core thing in
PHP 5.x depend on ICU.
It can and should be done as part of intl, actually.
But that's somehow unrelated
On Tue, Jun 21, 2011 at 4:38 PM, John Crenshaw johncrens...@priacta.com wrote:
This mindset is fundamentally broken. You can call it a byte array all you
want, but the truth is that 99.999% of the time, when a developer is using a
string they need it for characters, not for bytes
Let me
2011.06.21 17:38 John Crenshaw rašė:
Pierre Joye wrote:
On Tue, Jun 21, 2011 at 1:33 PM, Lester Caineles...@lsces.co.uk
wrote:
Pierre Joye wrote:
It depended on ICU there, and I would be against making a core thing
in
PHP 5.x depend on ICU.
It can and should be done as part of intl,
As a userland developer due to my geographical nature i have to work with 3
languages constantly - english, russian (cyryllic) and latvian (witch has
it's own share of non latin characters). I end up using utf-8 in every
project. And some give me a headake of dealing with text parsing. mb_string
Am 21.06.2011 17:55, schrieb Tomas Kuliavas:
They submit it in utf-8 only if your html form allows them to do that or
they don't follow html specification and try to exploit your form. Set
form input charset to iso-8859-1 and your nbspace will take only one byte.
and this naive attitude is
On Tue, Jun 21, 2011 at 6:14 PM, Reindl Harald h.rei...@thelounge.netwrote:
Am 21.06.2011 17:55, schrieb Tomas Kuliavas:
They submit it in utf-8 only if your html form allows them to do that or
they don't follow html specification and try to exploit your form. Set
form input charset to
Am 21.06.2011 18:22, schrieb Ferenc Kovacs:
On Tue, Jun 21, 2011 at 6:14 PM, Reindl Harald h.rei...@thelounge.netwrote:
Am 21.06.2011 17:55, schrieb Tomas Kuliavas:
They submit it in utf-8 only if your html form allows them to do that or
they don't follow html specification and try to
On Tue, Jun 21, 2011 at 6:24 PM, Reindl Harald h.rei...@thelounge.netwrote:
Am 21.06.2011 18:22, schrieb Ferenc Kovacs:
On Tue, Jun 21, 2011 at 6:14 PM, Reindl Harald h.rei...@thelounge.net
wrote:
Am 21.06.2011 17:55, schrieb Tomas Kuliavas:
They submit it in utf-8 only if your
They submit it in utf-8 only if your html form allows them to do that or
they don't follow html specification and try to exploit your form.
If no explicit encoding is given, all modern browsers will attempt to
autodetect the encoding based on the page contents, often with unpredictable
From: Pierre Joye [mailto:pierre@gmail.com]
On Tue, Jun 21, 2011 at 4:38 PM, John Crenshaw johncrens...@priacta.com
wrote:
This mindset is fundamentally broken. You can call it a byte array all you
want, but the truth is that 99.999% of the time, when a developer is using
a
2011.06.21 19:24 Reindl Harald rašė:
Am 21.06.2011 18:22, schrieb Ferenc Kovacs:
On Tue, Jun 21, 2011 at 6:14 PM, Reindl Harald
h.rei...@thelounge.netwrote:
Am 21.06.2011 17:55, schrieb Tomas Kuliavas:
They submit it in utf-8 only if your html form allows them to do that
or
they don't
Am 21.06.2011 19:12, schrieb Tomas Kuliavas:
and this naive attitude is the root of most security problems!
why do you believe that every client submission is coming over
your form or generally over anything you can control?
that doesn't matter here, Tomas just corrected John, that his
2011.06.21 20:51 Reindl Harald rašė:
utf-8 is strict format. If you expect utf-8 and someone submits
something
else, you can tell that without any string function. You can verify
utf-8
strings in pcre. You can convert nbspace to regular space, if you want.
utf-8 does not have any byte
Am 21.06.2011 22:19, schrieb Tomas Kuliavas:
2011.06.21 20:51 Reindl Harald rašė:
utf-8 is strict format. If you expect utf-8 and someone submits
something
else, you can tell that without any string function. You can verify
utf-8
strings in pcre. You can convert nbspace to regular space,
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's also quite intuitive to use foreach()
for strings, too.
If you want to implement a parser in PHP, you have to go the way with for +
strlen + substr() or $x[$i] to address one character
On Mon, 20 Jun 2011, Robert Eisele wrote:
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's also quite intuitive to use foreach()
for strings, too.
If you want to implement a parser in PHP, you have to go the way with for +
2011/6/20 Derick Rethans der...@php.net
On Mon, 20 Jun 2011, Robert Eisele wrote:
foreach() has many functions, looping over arrays, objects and
implementing
the iterator interface. I think it's also quite intuitive to use
foreach()
for strings, too.
If you want to implement a parser
On Mon, 2011-06-20 at 13:27 +0200, Robert Eisele wrote:
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's also quite intuitive to use foreach()
for strings, too.
I would prefer a TextIterator as we had in the old PHP 6 as this
On Mon, 20 Jun 2011, Johannes Schlüter wrote:
On Mon, 2011-06-20 at 13:27 +0200, Robert Eisele wrote:
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's also quite intuitive to use foreach()
for strings, too.
I would prefer a
On Mon, 20 Jun 2011, Robert Eisele wrote:
2011/6/20 Derick Rethans der...@php.net
On Mon, 20 Jun 2011, Robert Eisele wrote:
foreach() has many functions, looping over arrays, objects and
implementing the iterator interface. I think it's also quite
intuitive to use foreach() for
2011/6/20 Johannes Schlüter johan...@schlueters.de:
On Mon, 2011-06-20 at 13:27 +0200, Robert Eisele wrote:
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's also quite intuitive to use foreach()
for strings, too.
I would prefer
hi Robert,
I would go with a RFC for that one, at least to document/cover edge
cases to help the doc team to properly document this change if it gets
approved.
Thanks for your work so far!
On Mon, Jun 20, 2011 at 1:27 PM, Robert Eisele rob...@xarg.org wrote:
foreach() has many functions,
On Mon Jun 20 09:11 AM, Lee davis wrote:
Could we also use current(), next() and key() for iteration of strings?
$string = 'string';
while ($char = current($string))
{
echo key($string) // Would output the offset position I assume 0,1,2
etc??
echo $char // outputs each letter
As long as it works on a premise that a string is a byte array and
each element represents 1 byte, +1 from me.
On Mon, Jun 20, 2011 at 7:27 AM, Robert Eisele rob...@xarg.org wrote:
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's
-Original Message-
From: Lee davis [mailto:leedavi...@gmail.com]
Sent: Monday, June 20, 2011 9:12 AM
To: Robert Eisele
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] foreach() for strings
I think this would be quite a useful feature, and am In favor of it.
However, I think
Hi!
foreach() has many functions, looping over arrays, objects and implementing
the iterator interface. I think it's also quite intuitive to use foreach()
for strings, too.
I'm not sure how you'd implement such thing, but then I think things
like next(), end(), etc. should work too...
--
From: Ilia Alshanetsky [mailto:i...@prohost.org]
As long as it works on a premise that a string is a byte array and
each element represents 1 byte, +1 from me.
Code written on this premise is almost always bug central when people finally
get around to realizing why they really do need to
57 matches
Mail list logo