Hola amigos, este foro me es muy útil en mis andanzas con Perl, aunque no me había registrado hasta ahora, que tengo un problemilla que no puedo solucionar
La cosa es que tengo problemas con la codificación en un cgi. Desde un formulario, se debe mandar una dirección web al
script y éste debe generar un resultado y mostrarlo en formato web, obviamente. El caso es que los caracteres no salen correctamente. He probado a especificar en la cabecera del html la codificación, y también la he especificado en el
script pero sigue sin funcionar:
Using html4strict Syntax Highlighting
<html>
<head>
<title>Nube de etiquetas</title>
</head>
<body>
<form action="http://localhost/cgi-bin/prueba.pl" method="POST">
<h3>Web para nube de etiquetas : <h3>
<p> <input type="text" name="url" size=30> </p>
<input type="submit" value="Enviar" name="B1">
</form>
</body>
</html>
Using perl Syntax Highlighting
#!/usr/bin/perl -w
use utf8;
binmode( STDOUT, ":utf8" );
print "Content-type:text/html\n\n";
print
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";
read( STDIN, $line, $ENV{'CONTENT_LENGTH'} );
@values = split( /&/, $line );
print "<html><head><title>Parsing with POST method</title></head>";
print "<body>\n";
print "<h2>These were the values sent</h2>\n";
foreach $i (@values) {
( $varname, $data ) = split( /=/, $i );
if ( $varname ne "B1" ) {
print "The variable is $varname, the value is $data<p>";
}
}
print "</body></html>\n";
El resultado es así:
The variable is url, the value is http://www.elpais.com%2Frss%2Ffeed.html ... Id%3D17041Espero que podáis ayudarme...
Un saludo.