|
Posted by Taras_96 on 02/09/07 12:36
On Feb 8, 5:26 pm, "Kimmo Laine" <s...@outolempi.net> wrote:
> "Taras_96" <taras...@gmail.com> wrote in message
>
> news:1170918221.814144.39540@s48g2000cws.googlegroups.com...
>
> > Hi everyone,
>
> >>From what I understand in of addcslashes, addcslashes should add a
> > backslash before every character listed in the character list. I've
> > done a couple of experiments:
>
> > echo bin2hex(addcslashes("a","a")) gives 5c31, as expected ('\'
> > followed by 'a')
>
> Ascii lowercase 'a' is 0x61, not 0x31. 0x31 is '1'. 0x5c is indeed a
> backslash. I got 61 when I tried the line above.
>
> > Next, I tried
>
> > echo bin2hex(addcslashes("\0","\0")); which gave 5c 30 30 30, which is
> > a backslash followed by 3 spaces.
>
> 0x30 is ascii '0' (zero), not a space (which is 0x20).
>
> > What's happening here?
>
> Something quite odd. Since \0 is the string terminating character, it would
> seem that it throws the functions a bit off. File a bug report?
You're right about my corrections. For some reason I knew that but I
typed in the wrong things! It's not a bug, it's a documented behavoiur
- see my previous post.
[Back to original message]
|