You asked for the code points E2, 98 and BA, and you got them. You then manually messed around with the UTF8 flag. Because of your environment, Perl encoded the three-character string as latin-1, so the bytes were E2 98 BA, and so you are lucky.
Please interpret that sequence of commands as a round-about way of specifying that I wanted a particular sequence of bytes in the scalar's PV. I could also have written it like this:
use Inline C => <<'END_C'; SV * get_smiley() { SV *const smiley_sv = newSV(3); SvPOK_on(smiley_sv); SvUTF8_on(smiley_sv); unsigned char *ptr = (unsigned char*)SvPVX(smiley_sv); *ptr++ = 0xE2; *ptr++ = 0x98; *ptr++ = 0xBA; *ptr = 0x00; SvCUR_set(smiley_sv, 3); return smiley_sv; } END_C my $smiley = get_smiley();
No, we see the warning because you're printing something that has the UTF8 flag set (and thus with certainty is a text string), to a filehandle that doesn't have an encoding attached to it.
Please refer to the message with the "résumé" sample. In that sample, a scalar with the UTF8 flag set is printed to a filehandle that has not had an encoding explicitly attached to it. No warning occurs.
we have to explain to you these bottomless inticacies of Unicode handling in Perl's internals if you're ever to understand what the heck your broken code really does.
Are you implying that I broke that code accidentally? ;)
In reply to Re^4: Interventionist Unicode Behaviors
by creamygoodness
in thread Interventionist Unicode Behaviors
by creamygoodness
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |