$ perl -MEncode -e '$o=encode("utf16","1234"); print $o' | xxd -g1 0000000: fe ff 00 31 00 32 00 33 00 34 ...1.2.3.4 $ perl -MEncode -e '$o=encode("utf16le","1234"); print $o' | xxd -g1 0000000: 31 00 32 00 33 00 34 00 1.2.3.4. $ perl -MEncode -e '$o=encode("utf16be","1234"); print $o' | xxd -g1 0000000: 00 31 00 32 00 33 00 34 .1.2.3.4