Hello

Thanks for your reply.

At 5:29 Uhr -0700 15.09.2005, Dan Kogai via RT wrote:
I could not duplicate the symptom on perl 5.8.7 but on 5.8.6 I did.
...
you run the code as follows (on my Mac OS X v10.4.2);

With my perl 5.8.7 I'm getting:
[EMAIL PROTECTED] chris > perl ./bugreport-test1
Encode::is_utf8($str) = 1
utf8::is_utf8($str) = 1
Encode::is_utf8($str) = 1
utf8::is_utf8($str) = 1
[EMAIL PROTECTED] chris > perl -T ./bugreport-test1
Encode::is_utf8($str) = 1
utf8::is_utf8($str) = 1
Encode::is_utf8($str) = 1
utf8::is_utf8($str) = 1

(thus the same as you with that version)

As you see, on 5.8.6 utf8::is_utf8() works fine while Encode::is_utf8
() does not.

Interesting, I will try my app with -T again with utf8::is_utf8.

 Also note on 5.8.7 the flag is set UNCONDITIONALLY,
whether the string contains U+100 and above or not.

yes, but that's fine for me.

Your test case can't explain the second mentioned problem I'm seeing -- I somehow had a case where, before writing to the file, I had a string (originating from LWP) which gave false from Encode::is_utf8 but still gave a shorter length() (thus I would have guessed indicating utf8 flag is on) than the byte length in the file it is then written to.

One thing to note: I'm not opening files with ">:utf8" or "<:raw", but:
  sysopen($fh,$path, O_EXCL|O_CREAT|O_RDWR, $mode)  for writing,
and
  open $fh,"<",$path  for reading.

That's the reason why I'm toggling off the utf8 flag of strings which have it manually (as shown in the code I pasted in my bug report) for the duration of the write, and using decode_utf8 later. I think I can't use ">:utf8", because not all strings I write have the utf8 flag on (some of the strings are binary data).

Christian.

Reply via email to