1# $Id: UnicodeExt.pm,v 1.1.1.1 2004/05/20 17:59:56 jpetri Exp $ 2 3package XML::SAX::PurePerl::Reader; 4use strict; 5 6use XML::SAX::PurePerl::Reader qw(CURRENT); 7use Encode; 8 9sub set_raw_stream { 10 my ($fh) = @_; 11 binmode($fh, ":bytes"); 12} 13 14sub switch_encoding_stream { 15 my ($fh, $encoding) = @_; 16 binmode($fh, ":encoding($encoding)"); 17} 18 19sub switch_encoding_string { 20 Encode::from_to($_[0], $_[1], "utf-8"); 21} 22 23sub nextchar { 24 my $self = shift; 25 $self->next; 26 27 return unless defined($self->[CURRENT]); 28 29 if ($self->[CURRENT] eq "\x0D") { 30 $self->next; 31 return unless defined($self->[CURRENT]); 32 if ($self->[CURRENT] ne "\x0A") { 33 $self->buffer("\x0A"); 34 } 35 } 36} 37 38 391; 40 41