 |

|
|
Elektronika.lt portalo forumas
Jūs esate neprisijungęs lankytojas. Norint dalyvauti diskusijose, būtina užsiregistruoti ir prisijungti prie forumo.
Prisijungę galėsite kurti naujas temas, atsakyti į kitų užduotus klausimus, balsuoti forumo apklausose.
Administracija pasilieka teisę pašalinti pasisakymus bei dalyvius,
kurie nesilaiko forumo taisyklių.
Pastebėjus nusižengimus, prašome pranešti.
Dabar yra 2025 12 21, 13:27. Visos datos yra GMT + 2 valandos.
|
|
|
 |
Forumas » Įvairūs » perl utf8
|
Jūs negalite rašyti naujų pranešimų į šį forumą Jūs negalite atsakinėti į pranešimus šiame forume Jūs negalite redaguoti savo pranešimų šiame forume Jūs negalite ištrinti savo pranešimų šiame forume Jūs negalite dalyvauti apklausose šiame forume
|
|
|
 |
 |
 |
perl utf8 |
Parašytas: 2009 04 11, 11:08 |
|
|
|
|
stai turiu toki perl koda, bet narsykleje jis rodo vienus heroglifus, gal galit pasakyt, kaip padaryt, kad perl rodytu utf8 simbolius.?
cia kodas:
| Kodas: |
#!/usr/bin/perl
#!/usr/local/bin/perl
#!/usr/sbin/perl
#!/usr/lib/perl
#########################################
# MCG News Grabber
# Created by Mike Ramirez
# www.mrcgiguy.com
#########################################
#########################################
# Variable Settings
#########################################
$useframe = 1; # Open links in frame = 1, no frame = 0.
$framescript = 'http://www.site.lt/cgi-bin/newsframe.cgi'; # URL to the newsframe script.
$fontsize = '9pt'; # The font size in points or pixels
$fontfam = 'tahoma'; # The font family
$bgcolor = '#F0F0F0'; # The td background color for the link
#########################################
use CGI::Carp qw(fatalsToBrowser);
use CGI;
use LWP::Simple;
use HTML::Entities;
my $q = CGI->new;
print $q->header;
my $show = $q->param("show");
my $feed = $q->param("feed");
my $width = $q->param("w");
my $m = $q->param("m");
my $yahootop = 'http://rss.news.yahoo.com/rss/topstories';
my $yahoosports = 'http://rss.news.yahoo.com/rss/sports';
my $yahoopolitics = 'http://rss.news.yahoo.com/rss/politics';
my $yahooentertain = 'http://rss.news.yahoo.com/rss/entertainment';
my $yahoobusiness = 'http://rss.news.yahoo.com/rss/business';
my $yahootech = 'http://rss.news.yahoo.com/rss/tech';
my $yahoohealth = 'http://rss.news.yahoo.com/rss/health';
my $yahooodd = 'http://rss.news.yahoo.com/rss/oddlyenough';
my $yahooscience = 'http://rss.news.yahoo.com/rss/science';
my $yahoomusic = 'http://rss.news.yahoo.com/rss/music';
my $weather = 'http://blogs.weather.com/blog/weather/index.xml?cm_ven=BLOG&cm_cat=rss&par=BLOG_rss';
my $internet = 'http://feeds.feedburner.com/InternetnewsRealtimeNewsForItManagers?format=xml';
my $slashdot = 'http://rss.slashdot.org/Slashdot/slashdot';
my $google = 'http://google.blogspace.com/rss';
# Choose the feed to use
my $url; my $custom = $q->param("c");
if ($feed eq 'ytop') {$url = $yahootop}
elsif ($feed eq 'ysports') {$url = $yahoosports}
elsif ($feed eq 'ypolitics') {$url = $yahoopolitics}
elsif ($feed eq 'yentertain') {$url = $yahooentertain}
elsif ($feed eq 'ybusiness') {$url = $yahoobusiness}
elsif ($feed eq 'ytech') {$url = $yahootech}
elsif ($feed eq 'yhealth') {$url = $yahoohealth}
elsif ($feed eq 'yodd') {$url = $yahooodd}
elsif ($feed eq 'yscience') {$url = $yahooscience}
elsif ($feed eq 'internet') {$url = $internet}
elsif ($feed eq 'weather') {$url = $weather}
elsif ($feed eq 'ymusic') {$url = $yahoomusic}
elsif ($feed eq 'slashdot') {$url = $slashdot}
elsif ($feed eq 'google') {$url =$google}
elsif ($custom) {$url = $custom}
else {$url = $yahootop}
# Get the feed and put it all on one line
my $content = get($url); $content =~ s/\n|\r//g;
$n=0;
print " document.write(\"<table width=$width cellpadding=5 cellspacing=0 border=0>\");\n ";
if (($feed eq 'slashdot') || ($m==1)) {
while ($content =~ m/<item rdf:about=\"(.*?)\">(.*?)<\/item>/g) {
my $results = $2;
my $title = $results;
$title =~ m/<title>(.*?)<\/title>/g; $title = $1;
$title =~ s/<!\[CDATA\[|\]\]>//g; decode_entities($title);
$title =~ s/\"/"/g;
my $link = $results;
$link =~ m/<link>(.*?)<\/link>/g; $link = $1;
$link =~ s/<!\[CDATA\[|\]\]>//g;
my $description = $results;
$description =~ m/<description>(.*?)<\/description>/g; $description = $1;
$description =~ s/img src/img style=\"padding-right:3px;padding-bottom:3px;\" src/g;
$description =~ s/<!\[CDATA\[|\]\]>//g;
decode_entities($description);
$description =~ s/\"/\'/g;
unless ($n >= $show) {
if ($useframe == 1) {
print " document.write(\"<tr><td bgcolor=$bgcolor><a href='$framescript?u=$link' style='font-size:$fontsize;font-family:$fontfam'>$title</a></td></tr>\");\n ";
print " document.write(\"<tr><td><div align=justify style='font-size:$fontsize;font-family:$fontfam;padding-bottom:3px;'>$description</div></td></tr>\");\n ";
} else {
print " document.write(\"<tr><td bgcolor=$bgcolor><a href='$link' target='_blank' style='font-size:$fontsize;font-family:$fontfam'>$title</a></td></tr>\");\n ";
print " document.write(\"<tr><td><div align=justify style='font-size:$fontsize;font-family:$fontfam;padding-bottom:3px;'>$description</div></td></tr>\");\n ";
}
}
$n++;
}
} else {
while ($content =~ m/<item>(.*?)<\/item>/g) {
my $results = $1;
my $title = $results;
$title =~ m/<title>(.*?)<\/title>/g; $title = $1;
$title =~ s/<!\[CDATA\[|\]\]>//g; decode_entities($title);
$title =~ s/\"/"/g;
my $link = $results;
$link =~ m/<link>(.*?)<\/link>/g; $link = $1;
$link =~ s/<!\[CDATA\[|\]\]>//g;
my $description = $results;
$description =~ m/<description>(.*?)<\/description>/g;
$description = $1; $description =~ s/img src/img style=\"padding-right:3px;padding-bottom:3px;\" src/g;
$description =~ s/<!\[CDATA\[|\]\]>//g; decode_entities($description);
$description =~ s/<p>|<\/p>//ig;
$description =~ s/\"/\'/g;
unless ($n >= $show) {
if ($useframe == 1) {
print " document.write(\"<tr><td bgcolor=$bgcolor><a href='$framescript?u=$link' style='font-size:$fontsize;font-family:$fontfam'>$title</a></td></tr>\");\n ";
print " document.write(\"<tr><td><div align=justify style='font-size:$fontsize;font-family:$fontfam;padding-bottom:3px;'>$description</div></td></tr>\");\n ";
} else {
print " document.write(\"<tr><td bgcolor=$bgcolor><a href='$link' target='_blank' style='font-size:$fontsize;font-family:$fontfam'>$title</a></td></tr>\");\n ";
print " document.write(\"<tr><td><div align=justify style='font-size:$fontsize;font-family:$fontfam;padding-bottom:3px;'>$description</div></td></tr>\");\n ";
}
}
$n++;
}
}
print " document.write(\"</table>\");\n "; |
|
|
|
|
|
|
 |
 |
|
 |
|
 |
Google paieška forume |
|
|
 |
Naujos temos forume |
|
 |
FS25 Tractors
Farming Simulator 25 Mods,
FS25 Maps,
FS25 Trucks |
 |
ETS2 Mods
ETS2 Trucks,
ETS2 Bus,
Euro Truck Simulator 2 Mods
|
 |
FS22 Tractors
Farming Simulator 22 Mods,
FS22 Maps,
FS25 Mods |
 |
Dantų protezavimas
All on 4 implantai,
Endodontija mikroskopu,
Dantų implantacija |
 |
FS25 Mods
FS25 Maps,
FS25 Cheats,
FS25 Install Mods |
 |
FS25 Mods
Farming Simulator 25 Mods,
FS25 Maps |
 |
ATS Trailers
American Truck Simulator Mods,
ATS Trucks,
ATS Maps |
 |
Must have farming mods
Farming simulator modhub,
Best farming simulator mods |
|

|
 |