in reply to Re^3: Rewriting a C# Encryption Function
in thread Rewriting a C# Encryption Function
Second, you really should not use "utf16" in this case -- better to specify what byte order you really want for the job, because that way, perl won't automatically add the BOM at the start of the string, and you won't have to byte-swap later:
$ 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
|
|---|