in reply to Re^3: Perl to Read/Write Window Unicode Text files
in thread Perl to Read/Write Window Unicode Text files

I found that, when you use UTF-16, Perl actually output a "Unicode big endian" text file, not "Unicode". Probably only following two lines of code are important to check the issue: open FH, "<:encoding(UTF-16)", "$inputFile" or die "can't open file"; open (NEWFILE, ">:encoding(UTF-16)","$outputFile") or die "can't open file";
  • Comment on Re^4: Perl to Read/Write Window Unicode Text files

Replies are listed 'Best First'.
Re^5: Perl to Read/Write Window Unicode Text files
by ikegami (Patriarch) on Aug 10, 2010 at 21:31 UTC

    I suggested that you use

    <:raw:perlio:encoding(UTF-16le)
    or
    <:raw:perlio:encoding(UTF-16le):crlf

    so I don't understand this reply to my post.

      I tried first one <:raw:perlio:encoding(UTF-16le) and it worked !!! It successfully read text a file in Window "Unicode" format and also saved output file as another "Unicode" text file. Thank you so much !!!