in reply to Parsing Problems

I'd suggest creating a Short, Self-Contained, Correct Example - 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 hexdump or od to show the input files, e.g. hexdump -C input.txt or od -tx1c input.txt*, and use Devel::Peek to show the data once it is read into Perl. For example:

$ 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 use warnings; use strict; use open qw/:std :encoding(UTF-8)/; use Devel::Peek; while (<>) { chomp; Dump($_); } $ perl 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{2 +0ac}llo, W\x{f6}rld!"] CUR = 16 LEN = 81

Update: To look at the input file, you might also be interested in my script enctool.

* Update 2: On Windows, one simple open-source hex dump tool (of many) can be downloaded here: