Thread Lib::XML, HTML::Entities, utf8, Perl5.6 vs Perl5.8 (11 answers)
Opened by esskar at 2005-04-07 08:37

renee
 2005-04-07 11:47
#4757 #4757
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Skript:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/perl -w

use strict;
use warnings;
use CGI;
use Data::Dumper;
use CGI::Carp qw(fatalsToBrowser);
use lib ('./perllib');
use XML::Simple;
use utf8;

my $file = './test.xml';
my $content = get_file($file);
my $html = ();

my $cgi = CGI->new();
print $cgi->header(-type => 'text/html');

my $jobs_h = XMLin($content);

print Dumper($jobs_h);

my $jobtitle = $cgi->escapeHTML($jobs_h->{content});
$jobtitle =~ s/([\x{80}-\x{FFFF}])/'&#' . ord($1) . ';'/gse;

print $jobtitle;


sub get_file{
my ($file) = @_;
my $cont = '';
{
local $/;
open(DAT,"<$file") or die $!;
$cont = <DAT>;
close DAT;
}
return $cont;
}


XML:
Code: (dl )
1
2
3
<?xml version="1.0" encoding="iso-8859-1"?>

<entry name="button_close">Schließen</entry>


Darstellung: siehe http://www.renee-baecker.de/renee_cgi/utf_acht.cgi
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Lib::XML, HTML::Entities, utf8, Perl5.6 vs Perl5.8