note
haukex
<p>I'd suggest creating a [id://1177642] - i.e. reducing both the input file and the code down to the bare minimum needed to reproduce the problem. That should help you narrow down the problem, and it also gives you something to post here. To remove all ambiguity, also use [man://hexdump] or [man://od] to show the input files, e.g. <c>hexdump -C input.txt</c> or <c>od -tx1c input.txt</c>*, and use [doc://Devel::Peek] to show the data once it is read into Perl. For example:</p>
<c>
$ hexdump -C test.txt
00000000 48 e2 82 ac 6c 6c 6f 2c 20 57 c3 b6 72 6c 64 21 |H...llo, W..rld!|
00000010 0a |.|
00000011
$ cat test.pl
use warnings;
use strict;
use open qw/:std :encoding(UTF-8)/;
use Devel::Peek;
while (<>) {
chomp;
Dump($_);
}
$ perl test.pl test.txt
SV = PV(0x55b66e50c080) at 0x55b66e547398
REFCNT = 1
FLAGS = (POK,pPOK,UTF8)
PV = 0x55b662e533d0 "H\342\202\254llo, W\303\266rld!"\0 [UTF8 "H\x{20ac}llo, W\x{f6}rld!"]
CUR = 16
LEN = 81
</c>
<p><i>Update:</i> To look at the input file, you might also be interested in my script [https://bitbucket.org/haukex/htools/src/HEAD/enctool|enctool].</p>
<p>* <b>Update 2:</b> On Windows, one simple open-source hex dump tool (of many) can be downloaded here: [https://github.com/hollasch/hex/releases/download/v1.1.0/hex.exe]</p>
1233707
1233707