我試圖保存一個頁面上有它的Unicode印地文字體。我已經嘗試了幾個從這個網站和其他,但似乎沒有任何工作。試圖用Unicode保存頁面印地文
我得到的錯誤與寬字符有關。
這裏是代碼我使用:
use CGI;
use strict;
use warnings;
use LWP::Simple;
use utf8;
use Encode qw(decode);
$url = "http://www.vedakosh.com/rig-veda/mandal-1/sukta-001/mantra-rig-01-001-001";
my $content = get $url or die "Couldn't get $url" unless defined $content;
my $file="1.html";
open FILE, ">:encoding(UTF-8)", "$file";
print FILE $content;
不知道我做錯了,可有人請幫助或建議的東西嗎?
請提供確切的錯誤字符串 – pcantalupo
'my $ content = get $ url或死...除非定義$ content;'看起來危險地接近['my $ var = $ x如果$ y'](http://stackoverflow.com/q/2161111)構建。 '$ content'不能在程序中的那個位置定義,所以後綴'unless'是不必要的。 – mob
此代碼不應產生該錯誤。由於未聲明的'$ url'(也可能是'$ content'),它將無法編譯。 –