perl-unicode

Re: binary compare of scalars

2000-05-04 09:16:17
On Thu, 04 May 2000 15:33:47 +0200, "Stefan Eissing" wrote:
Browsing through sv.c, pp.c and friends, what is the design
philosophy for using SVf_UTF8?

It indicates that character semantics apply for that particular SV.

                              join upgrades to utf8, but should eq
do the same?

Yes, but only when character semantics are explicitly disallowed
(i.e. no "use bytes" in scope).  Looks like the patch I sent was
missing that--see attached.

So, coming back to my original question: How am I to pass a BLOB 
byte array into perl and do a _binary_ compare with a scalar? Is
there need for an additional operator?

Sounds like you either don't want to set SVf_UTF8 on the SVs to be
compared, or want to put a "use bytes" in the scope of the comparison.
(The former applies when doing the comparison in C, and the latter
if you're doing the comparison at the perl level.)

For the background discussion (there's quite a bit of it) on where
the Unicode support is headed, see the perl5-porters archives here:

    http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/


Sarathy
gsar(_at_)ActiveState(_dot_)com
-----------------------------------8<-----------------------------------
Change 6061 by gsar(_at_)auger on 2000/05/04 16:09:28

        change#5921 neglected to make eq honor "use bytes"

Affected files ...

... //depot/perl/sv.c#231 edit

Differences ...

==== //depot/perl/sv.c#231 (text) ====
Index: perl/sv.c
--- perl/sv.c.~1~       Thu May  4 09:09:41 2000
+++ perl/sv.c   Thu May  4 09:09:41 2000
@@ -3923,7 +3923,7 @@
     if (cur1) {
        if (!str2)
            return 0;
-       if (SvUTF8(str1) != SvUTF8(str2)) {
+       if (SvUTF8(str1) != SvUTF8(str2) && !IN_BYTE) {
            if (SvUTF8(str1)) {
                sv_utf8_upgrade(str2);
            }
End of Patch.

<Prev in Thread] Current Thread [Next in Thread>