Kyshtynbai has asked for the wisdom of the Perl Monks concerning the following question:
I really don't know how to handle it. Here's some code of the script which adds this xml info:cat xml/newfile.xml <?xml version="1.0" encoding="UTF-8" ?> <?meta name="GENERATOR" content="XML::Smart/1.78 Perl/5.014002 [linux] +" ?> <quotes> <txt>English text is fine</txt> <play>Really fine </play> <txt dt:dt="binary.base64">0KbQuNGC0LDRgtCwDQoK</txt> <play dt:dt="binary.base64">0J/QvtC/0L7QsdCw0LLQsAo=</play> </quotes>
#!/usr/bin/perl use strict; use XML::Smart; use CGI; use HTML::Template; use lib ('../'); use MySite; my $q = CGI->new(); my %params = MySite::get_params($q); my $add_quote_success= HTML::Template->new(filename =>'../templates/ad +d_quote_success.tmpl'); my $add_quote_error= HTML::Template->new(filename =>'../templates/add_ +quote_error.tmpl'); if ($ENV{REQUEST_METHOD} ne 'POST') { print "Content-type: text/html\n\n"; print "Stop wgetting this script."; } else { if (($params{txt} eq '') or ($params{play} eq '')) { print $q->header(-charset => 'utf-8'); print $add_quote_error->output; } else { my $XML = XML::Smart->new('../xml/newfile.xml'); my $counter = @{$XML->{quotes}{txt}}; $XML->{quotes}{txt}[$counter] = "$params{txt}\n"; $XML->{quotes}{play}[$counter] = "$params{play}\n"; $XML->save('../xml/newfile.xml'); print $q->header(-charset => 'utf-8'); print $add_quote_success->output; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Smart and UTF-8
by choroba (Cardinal) on Jun 07, 2014 at 14:53 UTC | |
by Kyshtynbai (Sexton) on Jun 07, 2014 at 15:02 UTC | |
|
Re: XML::Smart and UTF-8
by ikegami (Patriarch) on Jun 21, 2014 at 06:57 UTC |