ranguard / text-vcard

Perl package to edit and create vCard(s) (RFC 2426)
22 stars 15 forks source link

use \x0D\x0A instead of \r\n as recommended by 'perldoc perlport'. #17

Closed kablamo closed 10 years ago

kablamo commented 10 years ago

I'm not sure why the tests are failing on win32. This pull request is mostly a guess.

perldoc perlport says:

   Perl uses "\n" to represent the "logical" newline, where what is logical may depend on the platform in use.  In MacPerl, "\n" always means "\015".
   In DOSish perls, "\n" usually means "\012", but when accessing a file in "text" mode, STDIO translates it to (or from) "\015\012", depending on
   whether you're reading or writing.  Unix does the same thing on ttys in canonical mode.  "\015\012" is commonly referred to as CRLF.

  A common misconception in socket programming is that "\n" eq "\012" everywhere.  When using protocols such as common Internet protocols, "\012" and
   "\015" are called for specifically, and the values of the logical "\n" and "\r" (carriage return) are not reliable.

       print SOCKET "Hi there, client!\r\n";      # WRONG
       print SOCKET "Hi there, client!\015\012";  # RIGHT