fibokowalsky has asked for the wisdom of the Perl Monks concerning the following question:
I can get the text in utf8 in different way but that's not nice, like:open my $FILE, "<:encoding(UCS-2)", 'TEXTCZ1.txt' or die "Cannot open +the TEXTCZ1.txt! \n"; my $content = do { local $/; <$FILE> };
Do you have any suggestions to reda directly from file as utf8? I also do not know why text from get() is different than in the file.my $text = get("http://ufal.mff.cuni.cz/~hajic/courses/npfl067/TEXTCZ1 +.txt"); open my $FILE, '>', 'file.txt' or die "$!\n"; print $FILE $text; open $FILE, "<:encoding(iso-8859-2)", 'file.txt' or die "$!\n"; open my $NEWFILE, ">:encoding(utf-8)", 'fileutf8.txt' or die "$!\n"; print $NEWFILE $_ while <$FILE>; open $FILE, "<:encoding(utf-8)", 'fileutf8.txt' or die "$!\n"; $content = do { local $/; <$FILE> };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading File with Czech text inside
by ig (Vicar) on Feb 27, 2011 at 04:14 UTC | |
by fibokowalsky (Initiate) on Mar 02, 2011 at 14:03 UTC | |
|
Re: Reading File with Czech text inside
by CountZero (Bishop) on Feb 27, 2011 at 17:50 UTC | |
by fibokowalsky (Initiate) on Mar 02, 2011 at 14:05 UTC | |
by CountZero (Bishop) on Mar 02, 2011 at 15:19 UTC | |
|
Re: Reading File with Czech text inside
by ikegami (Patriarch) on Feb 27, 2011 at 21:04 UTC | |
by fibokowalsky (Initiate) on Mar 02, 2011 at 14:07 UTC | |
by ikegami (Patriarch) on Mar 02, 2011 at 16:04 UTC | |
|
Re: Reading File with Czech text inside
by elef (Friar) on Feb 27, 2011 at 07:41 UTC | |
|
Re: Reading File with Czech text inside
by elef (Friar) on Feb 27, 2011 at 07:41 UTC |