in reply to Windows newlines in unicode

Hi BillKSmith,

Try adding the :crlf layer, i.e. open(my $in, "<:encoding(UTF-16):crlf", "INPUT.TXT"). I did a quick test and it works for me; CRLFs are converted to \n and paragraph mode ($/ = '';) works too.

Hope this helps,
-- Hauke D

Replies are listed 'Best First'.
Re^2: Windows newlines in unicode
by BillKSmith (Monsignor) on Sep 17, 2016 at 16:57 UTC
    That did it. Thanks a lot. I had not tried that because I had assumed that was the default under windows therefore not worth the trouble to look up the syntax. Is it always necessary to explicitly specify the crlf layer when using Unicode on windows?
    Bill

      Hi BillKSmith,

      Glad to help. From open:

      Note that if layers are specified in the three-argument form, then default layers ... are ignored. Those layers will also be ignored if you specifying [sic] a colon with no name following it. In that case the default layer for the operating system (:raw on Unix, :crlf on Windows) is used.

      Hope this helps,
      -- Hauke D