#!/usr/bin/perl -w use strict; use bytes; while ( <> ) { # utf8 if ( /^\xef\xbb\xbf/ ) { print $ARGV," UTF-8\n"; } # utf16le if ( /^\xff\xfe/ ) { print $ARGV," UTF-16-LE\n"; } # utf32le if ( /^\xff\xfe\x00\x00/ ) { print $ARGV," UTF-32-LE\n"; } # utf16be if ( /^\xfe\xff/ ) { print $ARGV," UTF-16-BE\n"; } # utf32be if ( /^\x00\x00\xfe\xff/ ) { print $ARGV," UTF-32-BE\n"; } }