home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / UnicodeExt.pm < prev    next >
Encoding:
Perl POD Document  |  2002-09-03  |  766 b   |  41 lines

  1. # $Id: UnicodeExt.pm,v 1.3 2002/09/03 19:30:36 matt Exp $
  2.  
  3. package XML::SAX::PurePerl::Reader;
  4. use strict;
  5.  
  6. use XML::SAX::PurePerl::Reader qw(CURRENT);
  7. use Encode;
  8.  
  9. sub set_raw_stream {
  10.     my ($fh) = @_;
  11.     binmode($fh, ":bytes");
  12. }
  13.  
  14. sub switch_encoding_stream {
  15.     my ($fh, $encoding) = @_;
  16.     binmode($fh, ":encoding($encoding)");
  17. }
  18.  
  19. sub switch_encoding_string {
  20.     Encode::from_to($_[0], $_[1], "utf-8");
  21. }
  22.  
  23. sub 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.  
  39. 1;
  40.  
  41.