Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18735 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12812 invoked by uid 1010); 9 Sep 2005 07:09:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 12796 invoked from network); 9 Sep 2005 07:09:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2005 07:09:19 -0000 X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:60636] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id EE/23-17383-D1531234 for ; Fri, 09 Sep 2005 03:09:17 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j8979ES7014753; Fri, 9 Sep 2005 09:09:14 +0200 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j89799aP014747; Fri, 9 Sep 2005 09:09:10 +0200 Date: Fri, 9 Sep 2005 09:09:09 +0200 (CEST) X-X-Sender: derick@localhost To: Andi Gutmans cc: PHP Developers Mailing List In-Reply-To: <6.2.3.4.2.20050908153336.042bc780@localhost> Message-ID: References: <6.2.3.4.2.20050908153336.042bc780@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at jdi-ict.nl Subject: Re: [PHP-DEV] ord() on binary strings From: derick@php.net (Derick Rethans) 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