pack('C'...) sets UTF8 flag

[email protected] ("Bob Hallissy")
Newsgroups perl.unicode
Message-ID <OF6AD874BE.CEB04085-ON80257036.004ED5F4-80257036.0050CCAD@notes.sil.org>
Am I doing something wrong or is this a bug:

use strict;
my $p;
foreach $p (qw (C U C))
{
   my $s = pack($p, 200);
   print "pack('$p', 200): is_utf8=" . (utf8::is_utf8($s) ? 'yes' : 'no ') 
. "\t$s\t" . join(',', unpack('C*', $s)) . "\n";
}

Generates the following output:

pack('C', 200): is_utf8=no      ╚       200
pack('U', 200): is_utf8=yes     ╚       195,136
Wide character in print at T:\test2.pl line 8.
pack('C', 200): is_utf8=yes     ╚       200

Specifically, the first and last ought to be the same, and I shouldn't be 
getting that error.

Seen on perl 5.8.3, 5.8.6 and 5.8.7. E.g., my current perl -v:
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 7 registered patches, see perl -V for more detail)

Copyright 1987-2005, Larry Wall

Binary build 813 [148120] provided by ActiveState 
http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  6 2005 13:36:37

TIA,

Bob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.