Opening UTF-16LE files in Perl —
Placeholder for useful code snippet:
open my $fh, '<:raw:perlio:encoding(UTF-16LE):crlf', $filename |
which will convert CR/LF combinations to LF only. Alternatively, to keep them intact:
open my $fh, '<:raw:perlio:encoding(UTF-16LE)', $filename |
Useful for reading Windows registry export files, SQL server log export files etc.
Categorised as: Hints and Tips | One-liners | Perl | SQL Server | Windows
Leave a Reply