in reply to Text File Encoding under Windows
When I print the file in the console, all characters appear separated by a strange extra whitespace.
The file is most likely encoded as UTF-16 (or UCS-2, which for most practical purposes doesn't make much of a difference). Try to open it with
open my $fh, "<:encoding(UTF-16LE)", ... while (<$fh>) {
( :encoding(UTF-16) should work, too, if the file has a BOM (byte order mark), which it typically has. In this case, the BOM itself (\x{feff}) also won't be part of the data read via <$fh>. )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Text File Encoding under Windows
by pat_mc (Pilgrim) on Mar 18, 2010 at 08:33 UTC | |
by almut (Canon) on Mar 18, 2010 at 09:35 UTC | |
by pat_mc (Pilgrim) on Mar 18, 2010 at 14:49 UTC |