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

First, that's completely unreadable. Please add <c>..</c> tags around computer text such as code, data, output, etc.

Secondly, it's way too long. It should not require more than 5 lines to demonstrate this problem.

Finally, it would be more fruitful to provide a hex dump of the data then posting funky characters.

Replies are listed 'Best First'.
Re^4: Perl to Read/Write Window Unicode Text files
by maylin (Initiate) on Aug 10, 2010 at 21:06 UTC
    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";

      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 !!!