i've encountered a pretty strange problem today dealing with an input/out file that uses a strange line ending format. the file is a configuration file for mcafee's netshield for netware, and instead of the normal DOS CR/LF (\x0D\x0A) line endings, it uses LF/CR (\x0A\x0D). ok, no problem, i'll just set up my input and output record seps and i'll be all set.

not quite.

take a look at this script:

$testvar1 = "\x0A\x0D"; $testvar2 = "\x0A\x0D"; $testvar3 = "\x0A"; $testvar4 = "\x0D"; $testvar5 = "foo\x0Abar"; print("testvar1 = \"$testvar1\"\n"); print("testvar2 = \"$testvar2\"\n"); print("testvar3 = \"$testvar3\"\n"); print("testvar4 = \"$testvar4\"\n"); print("testvar5 = \"$testvar5\"\n");

dumping this out to a file and examing the resulting text in a hex editor, i get the following:

testvar1 = "\x0D\x0A\x0D"
testvar2 = "\x0D\x0A\x0D"
testvar3 = "\x0D\x0A"
testvar4 = "\x0D"
testvar5 = "foo\x0D\x0Abar"

the values inside the quotes have been expanded back in hex notation by myself, and the real cr/lf on the end of each line ommitted. what looks to be happening is that any time perl win32 sees a LF in a string, it automagically prepends a CR. needless to say, this behavior is fantasticly annoying and i'd really like to disable it somehow. any thoughts from the bretheren?

luma::s-video


In reply to ActivePerl 5.6.1 Win32 munging CR/LFs by luma

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.