Why Read In UTF-16LE File Won't Convert "\r\n" Into "\n" In Windows
- by Dbger
I am using Perl to read UTF-16LE files in Windows 7.
If I read in an ascii file with following code:
open CUR_FILE, "<", $asciiFile;
Then each "\r\n" in file will be converted into a "\n" in memory;
if I read in an UTF-16LE(windows 1200) file with following code:
open CUR_FILE, "<:encoding(UTF-16LE)", $utf16leFile;
Then "\r\n" will keep unchanged.
This inconsistency cause problems when I trying to regexp lines with line breaks.
My questions is:
Is this how unicode works in Perl & Windows? Or Am I using the wrong code?
Thanks so much!