Is \r\n considered as two or four characters?

?

-

Is \r\n considered as two or four characters?

While reading an RFC, it stated that "the maximum length of a message
shall not exceed 512 characters, including the trailing CR-LF. Thus,
there are 510 characters allowed for the command and parameters".
 
S

Stefan Schulz

Is \r\n considered as two or four characters?

Two. You only encode it so the compiler knows you mean the normally
unprintable character, and replaces it in your string.
 
P

Paul Bilnoski

- said:
Is \r\n considered as two or four characters?

While reading an RFC, it stated that "the maximum length of a message
shall not exceed 512 characters, including the trailing CR-LF. Thus,
there are 510 characters allowed for the command and parameters".

It is considered two characters.
The backslash escapes the following character (sequence) to have special
meaning, and to be a single character. Look up character escape
sequences in about any Java book for more info. Unicode escape sequences
like \u0035 are also considered a single character but they take six to
write them.
--Paul
 
O

Owen Jacobson

Is \r\n considered as two or four characters?

While reading an RFC, it stated that "the maximum length of a message
shall not exceed 512 characters, including the trailing CR-LF. Thus,
there are 510 characters allowed for the command and parameters".

1459? *grin*

"\r\n" is encoded as the octet sequence 0D 0A, I believe (that might be
backwards and I can't be arsed to check) after the escape sequences are
turned into characters and the characters into ASCII (as per the RFC).

(You can get away with using UTF-8 instead of ascii without breaking
existing clients too much.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top