How many bytes \ n \ r?

I have a .NET application that is trying to load an ftp file, but I get 1 extra byte per line. My line break is Environment.NewLine, which I believe translates to \ n \ r. How many bytes is this?

+3
source share
7 answers

It depends on the encoding. In 8-bit encodings, as well as UTF-8, these are 2 bytes. In UCS-2 or UTF-16, these are 4 bytes. In UCS-4 or UTF-32, this is 8 bytes.

But the problem is that you are probably the FTP server in ASCII mode instead of IMAGE mode.

+27
source

These are 2 bytes, but this should \r\nnot be \n\rfor Windows

+7
source

ASCII\n 0x0A ( 10),\r 0x0D ( 13).

, CR-LF, .

FTP, , LF- , , .

+3

. \n \r.

+2

:

, ascii-transfer #,

FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://example.com"));
reqFTP.UseBinary = true;
+2

\n\r - 2 .

+1

FTP . . , , .

0

Source: https://habr.com/ru/post/1747238/


All Articles