ispman/lib ISPMan.pm,1.32,1.33

[email protected]
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv26077

Modified Files:
	ISPMan.pm 
Log Message:
Replacing Text::Iconv with Unicode::String
Changing utf2lat and lat2utf accordingly.

Older functions xutf2lat xlat2utf and convert_encoding will be removed in the cleanup



Index: ISPMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan.pm,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- ISPMan.pm	8 Aug 2003 16:45:43 -0000	1.32
+++ ISPMan.pm	14 Jan 2004 15:48:24 -0000	1.33
@@ -135,8 +135,8 @@
    $self->{'mday'}=$mday;
 
 	if (defined $Config->{'convert_encoding'} && $Config->{'convert_encoding'}){
-		require Text::Iconv;
-		import Text::Iconv;
+		require Unicode::String;
+		import Unicode::String 	qw(latin1 utf8 utf16);
 	}
 
 
@@ -417,23 +417,56 @@
    return $self->{'dnsdata'}{$dn} if $type eq "soarecords";
    return $self->as_array($self->{'dnsdata'}{$dn}{'record'});
 }
+
+
 
 
 
-
-sub utf2lat {
-   my $self=shift;
-   
+sub utf2lat {
+	my $self=shift;
    return $_[0]  unless (defined $self->{'Config'}{'convert_encoding'} && $self->{'Config'}{'convert_encoding'});
-   my $converter=new Text::Iconv $self->{'Config'}{'encoding'}{'utf8'}, $self->{'Config'}{'encoding'}{'local'};
-   return $self->convert_encoding($converter, @_);
+	my $string=shift;
+   if (ref $string eq "ARRAY") {
+      my @newstring=();
+      my $str;
+      for $str (@$string) {
+         push @newstring, utf8($str)->latin1;
+      }
+      return \@newstring;
+   } else {
+      return utf8($string)->latin1;
+   }
+}
+
+sub lat2utf {
+	my $self=shift;
+    return $_[0]  unless (defined $self->{'Config'}{'convert_encoding'} && $self->{'Config'}{'convert_encoding'});
+	my $string=shift;
+   if (ref $string eq "ARRAY") {
+      my @newstring=();
+      my $str;
+      for $str (@$string) {
+         push @newstring, latin1($str)->utf8;
+      }
+      return \@newstring;
+   } else {
+      return latin1($string)->utf8;
+   }
+}
+
+
+sub xutf2lat {
+   my $self=shift;
+   #return $_[0]  unless (defined $self->{'Config'}{'convert_encoding'} && $self->{'Config'}{'convert_encoding'});
+   #my $converter=new Text::Iconv $self->{'Config'}{'encoding'}{'utf8'}, $self->{'Config'}{'encoding'}{'local'};
+   #return $self->convert_encoding($converter, @_);
 }
 
-sub lat2utf {
-   my $self=shift;
-   return $_[0] unless (defined $self->{'Config'}{'convert_encoding'} && $self->{'Config'}{'convert_encoding'});
-   my $converter=new Text::Iconv $self->{'Config'}{'encoding'}{'local'}, $self->{'Config'}{'encoding'}{'utf8'};
-   return $self->convert_encoding($converter, @_);
+sub xlat2utf {
+   my $self=shift;
+   #return $_[0] unless (defined $self->{'Config'}{'convert_encoding'} && $self->{'Config'}{'convert_encoding'});
+   #my $converter=new Text::Iconv $self->{'Config'}{'encoding'}{'local'}, $self->{'Config'}{'encoding'}{'utf8'};
+   #return $self->convert_encoding($converter, @_);
 }
 
 




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.