Re: ord() on binary strings

From: Date: Fri, 09 Sep 2005 07:09:09 +0000
Subject: Re: ord() on binary strings
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-18735@lists.php.net to get a copy of this message
On Thu, 8 Sep 2005, Andi Gutmans wrote: > Did Andrei have a reason besides the docs? Even without IS_UNICODE/IS_BINARY > it sounds like the docs could use tuning anyway, no? Andrei: The docs say "Return ASCII value of character", which doesn't make sense for binary. You can use bin2hex(), bin2hex() == ord() for binary. (Which is not true, as it doesn't return the ordinal value, just a two digit hex string) Derick: anyway, ord() always worked on string like this, seems strange to break it (and yes, it already did) Andrei: you had binary strings before? Derick: normal strings of course, but it came from a file, so it turned binary and ord() started failing Andrei: Then you should fix your code and convert that binary to something sensible if you are reading text Derick: it's not text, it's binary Andrei: if it's binary, why do you need to know the ascii value Derick: Because I'm converting a binary file to a C file (for the timezone database) Then he continues saying that it's Ok to break BC in unicode mode. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

« previous php.internals (#18735) next »