Returns the character represented by that NUMBER in the character set.
For example, C<chr(65)> is C<"A"> in either ASCII or Unicode, and
-chr(0x263a) is a Unicode smiley face (but only within the scope of
-a C<use utf8>). For the reverse, use L</ord>.
+chr(0x263a) is a Unicode smiley face. Within the scope of C<use utf8>,
+characters higher than 127 are encoded in Unicode; if you don't want
+this, temporarily C<use bytes> or use C<pack("C*",...)>
+
+For the reverse, use L</ord>.
See L<utf8> for more about Unicode.
If NUMBER is omitted, uses C<$_>.
(void)SvUPGRADE(TARG,SVt_PV);
- if (value > 255 && !IN_BYTE) {
+ if ((value > 255 && !IN_BYTE) || (value & 0x80 && PL_hints & HINT_UTF8) ) {
SvGROW(TARG, UTF8_MAXLEN+1);
tmps = SvPVX(TARG);
tmps = (char*)uv_to_utf8((U8*)tmps, (UV)value);
}
}
-print "1..65\n";
+print "1..67\n";
my $test = 1;
ok "\x{ab}" =~ /^\x{ab}$/, 1;
$test++; # 65
}
+
+{
+ use utf8;
+ ok_bytes chr(0xe2), pack("C*", 0xc3, 0xa2);
+ $test++; # 66
+}