# Revision history for Perl extension Encode.
#
-# $Id: Changes,v 1.83 2002/11/18 17:28:49 dankogai Exp dankogai $
+# $Id: Changes,v 1.84 2003/01/10 12:00:16 dankogai Exp dankogai $
#
-$Revision: 1.83 $ $Date: 2002/11/18 17:28:49 $
+$Revision: 1.84 $ $Date: 2003/01/10 12:00:16 $
+! encoding.pm
+ ${^ENCODING} is no longer set for utf so encoding is no longer fun :)
+ (That is to prevent duplicate encoding first by IO then ${^ENCODING})
+ Message-Id: <20030108213737.GK331043@lyta.hut.fi>
+! Unicode/Unicode.xs
+ %_ fixes saves the resulting .so .05% smaller, by NC
+ Message-Id: <20021226225709.GF284@Bagpuss.unfortu.net>
+! Encode.pm
+ Silence Encode on undef, by Andreas
+ Message-Id: <m3smwrohd1.fsf@k242.linux.bogus>
+ Message-Id: <m3of7fo7np.fsf@k242.linux.bogus>
+! Unicode/Unicode.xs
+ s/regognised/recognised/ . British spelling left intact to pay
+ respect to two British Nicks :)
+ Message-Id: <20021203020454.GK2274@kosh.hut.fi>
+
+1.83 2002/11/18 17:28:49
! Encode.xs lib/Encode/JIS7.pm
Even more patches from Inaba-san has been applied. With this
patch t/uni/tr_7jis.t and t/uni/t_utf8.t of bleedperl will work.
#
-# $Id: Encode.pm,v 1.83 2002/11/18 17:28:29 dankogai Exp $
+# $Id: Encode.pm,v 1.84 2003/01/10 12:00:16 dankogai Exp dankogai $
#
package Encode;
use strict;
-our $VERSION = do { my @r = (q$Revision: 1.83 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.84 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
our $DEBUG = 0;
use XSLoader ();
XSLoader::load(__PACKAGE__, $VERSION);
sub encode($$;$)
{
my ($name, $string, $check) = @_;
+ return undef unless defined $string;
$check ||=0;
my $enc = find_encoding($name);
unless(defined $enc){
sub decode($$;$)
{
my ($name,$octets,$check) = @_;
+ return undef unless defined $octets;
$check ||=0;
my $enc = find_encoding($name);
unless(defined $enc){
sub from_to($$$;$)
{
my ($string,$from,$to,$check) = @_;
+ return undef unless defined $string;
$check ||=0;
my $f = find_encoding($from);
unless (defined $f){
/*
- $Id: Unicode.xs,v 1.5 2002/05/20 15:25:44 dankogai Exp $
+ $Id: Unicode.xs,v 1.6 2003/01/10 12:00:16 dankogai Exp dankogai $
*/
#define PERL_NO_GET_CONTEXT
endian = 'V';
}
else {
- croak("%s:Unregognised BOM %"UVxf,
- SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)),
+ croak("%"SVf":Unregognised BOM %"UVxf,
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0),
bom);
}
}
if (size != 4 && invalid_ucs2(ord)) {
if (ucs2) {
if (check) {
- croak("%s:no surrogates allowed %"UVxf,
- SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)),
+ croak("%"SVf":no surrogates allowed %"UVxf,
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0),
ord);
}
if (s+size <= e) {
else {
UV lo;
if (!isHiSurrogate(ord)) {
- croak("%s:Malformed HI surrogate %"UVxf,
- SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)),
+ croak("%"SVf":Malformed HI surrogate %"UVxf,
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0),
ord);
}
if (s+size > e) {
}
lo = enc_unpack(aTHX_ &s,e,size,endian);
if (!isLoSurrogate(lo)){
- croak("%s:Malformed LO surrogate %"UVxf,
- SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)),
+ croak("%"SVf":Malformed LO surrogate %"UVxf,
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0),
ord);
}
ord = 0x10000 + ((ord - 0xD800) << 10) + (lo - 0xDC00);
SvCUR_set(result,d - (U8 *)SvPVX(result));
}
if (s < e) {
- Perl_warner(aTHX_ packWARN(WARN_UTF8),"%s:Partial character",
- SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)));
+ Perl_warner(aTHX_ packWARN(WARN_UTF8),"%"SVf":Partial character",
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0));
}
if (check && !(check & ENCODE_LEAVE_SRC)){
if (s < e) {
if (!issurrogate(ord)){
if (ucs2) {
if (check) {
- croak("%s:code point \"\\x{%"UVxf"}\" too high",
- SvPV_nolen(
- *hv_fetch((HV *)SvRV(obj),"Name",4,0))
- ,ord);
+ croak("%"SVf":code point \"\\x{%"UVxf"}\" too high",
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0),ord);
}
enc_pack(aTHX_ result,size,endian,FBCHAR);
}else{
}
}
if (s < e) {
- Perl_warner(aTHX_ packWARN(WARN_UTF8),"%s:Partial character",
- SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)));
+ Perl_warner(aTHX_ packWARN(WARN_UTF8),"%"SVf":Partial character",
+ *hv_fetch((HV *)SvRV(obj),"Name",4,0));
}
if (check && !(check & ENCODE_LEAVE_SRC)){
if (s < e) {