Ah. Thanks for that. I've changed that script to:
perl -i -pe 'BEGIN{binmode STDOUT,":encoding(utf16le)"; undef $/;} s/\xFF\xFE/\xFF\xFEFilename:$ARGV\n/' `find . -name '*.TXT'`however have since discovered that simply writing my new code over the BOM of the original data solved my problem:
perl -i -pe 'BEGIN{undef $/;} s/\xFF\xFE/Filename:$ARGV\n/' `find . -name '*.TXT'`I'm not sure if this is because my source data might actually be mixed utf8 and utf16le. In summary then - I don't think I've actually solved outputting in utf-16LE however I have solved my issue at present. Thanks very much to your reply and many of the other posts on this site which helped me comprehend this. Any other tips welcome.
In reply to Re^2: PERL Command line to batch add filename to start of file in UTF-16le
by irenabyss
in thread PERL Command line to batch add filename to start of file in UTF-16le
by irenabyss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |