Answer the question
In order to leave comments, you need to log in
How to teach Perl script to work in UTF8?
this is the result of incorrect work with the encoding of my script.
index.html:
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<title>Поиск по группе РОСА ВКонтакте</title>
<meta name="generator" content="Geany 1.28 on GNU/Linux" />
</head>
<body>
<center>
<form method="GET" action="/cgi-bin/rosa-search.pl" formenctype="application/x-www-form-urlencoded">
<h1>Введите поисковый запрос<br />для поиска по группе<br /><a href="https://vk.com/rosalab" target="_blank">«РОСА Линукс» ВКонтакте</a>.</h1>
<input type="text" name="search_request">
<input type="hidden" name="search_parametrs" value=" site:vk.com">
<!-- пробелы в value стоят специально -->
<input type="hidden" name="vk_group_name" value=" роса линукс">
<br /><input type="submit" value="Искать!">
</form>
</center>
</body>
</html>
#!/usr/bin/perl -w
# за основу взято https://www.sitepoint.com/uploading-files-cgi-perl-2/
use strict;
use utf8;
use CGI qw/ :standard -debug /;
# подключаем модуль дл вывода подробных ошибок
use CGI::Carp qw ( fatalsToBrowser );
use File::Basename;
use Text::Iconv;
my $query = new CGI;
# считываем параметры, переданные нам с HTML формы
my $search_request = $query->param("search_request");
my $search_parametrs = $query->param("search_parametrs");
my $vk_group_name = $query->param("vk_group_name");
my $google = "https://www.google.ru/#newwindow=1&q=";
my $string0 = $google.$search_request . $search_parametrs . $vk_group_name;
# print $string0;
print $query->header ( );
# binmode(STDOUT, ":utf8");
print <<END_HTML;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0;URL='$string0'" />
<head>
</html>
END_HTML
Answer the question
In order to leave comments, you need to log in
CGI in the 21st century is something.
Get Dancer or Mojolicious, don't do necrophilia.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question