/[webpac]/trunk/test_charset.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/test_charset.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 40 - (hide annotations)
Sat Mar 15 21:33:36 2003 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 812 byte(s)
major de-mungling of different codepages: use same codepage inside perl
(as opposed to UTF-8) and in files on disk

1 dpavlin 36 #!/usr/bin/perl -w
2    
3     use strict;
4     use OpenIsis;
5     use Text::Iconv;
6 dpavlin 40 use XML::Simple;
7     use Data::Dumper;
8 dpavlin 36
9     Text::Iconv->raise_error(1); # Conversion errors raise exceptions
10    
11     #my $to = "UTF-8";
12     my $to = "ISO-8859-2";
13    
14     my $isis_codepage = Text::Iconv->new('852',$to);
15    
16     my $isis_db="/data/isis_data/small/ps/PERI/PERI";
17     my $row_id = 11;
18    
19     my $db = OpenIsis::open( $isis_db );
20    
21     my $row = OpenIsis::read( $db, $row_id );
22    
23     use isis_sf;
24    
25 dpavlin 40 print isis_sf($row,'200'),"\n";
26 dpavlin 36
27 dpavlin 40 my $xml = '<?xml version="1.0" encoding="ISO-8859-2"?><xml>truæ</xml>';
28     #my $xml_codepage = Text::Iconv->new('ISO-8859-2','UTF-8');
29     #$xml = XMLin($xml_codepage->convert($xml));
30    
31     $xml = XMLin($xml);
32    
33     #undef $xml_codepage;
34     my $xml_codepage = Text::Iconv->new('UTF-8','iso-8859-2');
35     $xml = $xml_codepage->convert($xml),"\n";
36    
37     print Dumper($xml),"$xml\n";
38    

Properties

Name Value
cvs2svn:cvs-rev 1.2
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26