in reply to Problem with utf8 after nearly 4096 bytes
Hi guys,
I'm reviving this discussion because I'm so much closer of the solution.
I finally discovered what is the real problem: Perl only recognizes the first 4096 bytes as utf8 because only the first block of text have the BOM. So he thinks that the first block is utf8 (and it goes ok) but recognizes all the other blocks as Unicode. So if I put a few en dashs ("–") I can force the code to interpretate Unicode as utf8. Buuuut, I can't expect that the users to put these en dashs. The program will be used by some oldschool Linguistics researchers, with almost none computer knowledge.
I tryed to force dashs by concatenating each line of the file with an en dash:
while(my $l = <$fh>){ $text .= "–".$l; }
But I get this error:
Wide character in print at (eval 12) line 94.
Any idea of how could I force this (or another) character to make perl understand that the block is in utf8? If there's any other way to do it, would be awesome too.
Thanks guys
Vieira
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with utf8 after nearly 4096 bytes
by farang (Chaplain) on Sep 08, 2013 at 01:47 UTC | |
by gvieira (Initiate) on Sep 08, 2013 at 03:05 UTC | |
by farang (Chaplain) on Sep 09, 2013 at 04:14 UTC |