Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your file seems to be encoded in UTF-16LE. The bytes notepad adds are called "Byte Order Mark", or just BOM.</p> <p>Here's how you can read your file using Perl:</p> <pre><code>use strict; use warnings; use Encode; # list loaded encodings print STDERR map "* $_\n", Encode-&gt;encodings; # read arguments my $enc = shift || 'utf16'; die "no files :-(\n" unless @ARGV; # process files for ( @ARGV ) { open my $fh, "&lt;:encoding($enc)", $_ or die "open $_: $!"; print &lt;$fh&gt;; close $fh; } # loaded more encodings now print STDERR map "* $_\n", Encode-&gt;encodings; </code></pre> <p>Proceed like this, taking care to supply the correct encoding for your file:</p> <pre><code>perl open.pl utf16 open.utf16be.txt perl open.pl utf16 open.utf16le.txt perl open.pl utf16le open.utf16le.nobom.txt </code></pre> <p>Here's the revised version following tchrist's suggestions:</p> <pre><code>use strict; use warnings; use Encode; # read arguments my $enc_in = shift || die 'pass file encoding as first parameter'; my $enc_out = shift || die 'pass STDOUT encoding as second parameter'; print STDERR "going to read files as encoded in: $enc_in\n"; print STDERR "going to write to standard output in: $enc_out\n"; die "no files :-(\n" unless @ARGV; binmode STDOUT, ":encoding($enc_out)"; # latin1, cp1252, utf8, UTF-8 print STDERR map "* $_\n", Encode-&gt;encodings; # list loaded encodings for ( @ARGV ) { # process files open my $fh, "&lt;:encoding($enc_in)", $_ or die "open $_: $!"; print while &lt;$fh&gt;; close $fh; } print STDERR map "* $_\n", Encode-&gt;encodings; # more encodings now </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload