If UTF-8 data is important to you, you need to insist on having perl 5.8+. 5.6.1 was almost there, but not good enough.
Your open statement would be fine in 5.8 aside from not checking return status. The difficulty is likeliest coming from the PerlIO mode argument. PerlIO wasn't the default until 5.8.
| [reply] |
Use a newer Perl, really. 5.6.1 is 6 years old, and in software years, that's very old :)
Also, use :encoding(UTF-8) when reading a file. If you use :utf8, perl assumes that everything is valid UTF8 data. When it happens to be invalid, for whatever reason, perl won't detect it. It will cause internal corruption, and that can theoretically lead to security problems and if you're lucky, crashes.
:utf8 is safe for *writing* only.
| [reply] |