# Encoding is 16-bit network order Unicode (no surogates)
# Used for X font encodings
-__PACKAGE__->Define(qw(UCS-2 iso10646-1));
+__PACKAGE__->Define(qw(UCS-2 iso-10646-1));
sub decode
{
$uni .= chr($code);
}
$_[1] = $str if $chk;
- Encode::utf8_upgrade($uni);
+ utf8::upgrade($uni);
return $uni;
}
UCS-2 can only represent 0..0xFFFF, while UTF-16 has a "surogate pair"
scheme which allows it to cover the whole Unicode range.
-Encode implements big-endian UCS-2 aliased to "iso10646-1" as that
+Encode implements big-endian UCS-2 aliased to "iso-10646-1" as that
happens to be the name used by that representation when used with X11 fonts.
UTF-32 or UCS-4 is 32-bit or 4-byte chunks. Perl's logical characters
{
PerlIOEncode *e = PerlIOSelf(f,PerlIOEncode);
IV code = 0;
- dTHX;
- if (e->bufsv && (PerlIOBase(f)->flags & (PERLIO_F_RDBUF|PERLIO_F_WRBUF)))
+ if (e->bufsv && (PerlIOBase(f)->flags & (PERLIO_F_RDBUF|PERLIO_F_WRBUF))
+ &&(e->base.ptr > e->base.buf)
+ )
{
+ dTHX;
dSP;
SV *str;
char *s;
SvCUR_set(src,SvCUR(src)-slen);
}
}
+ else
+ {
+ SvCUR_set(dst,slen);
+ SvPOK_on(dst);
+ }
return dst;
}