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".
Stefan Schulz - 10 Jul 2005 11:36 GMT
> 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.

Signature
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"
Boudewijn Dijkstra - 10 Jul 2005 13:45 GMT
> Is \r\n considered as two or four characters?
In this case you use four characters to describe two characters.
Paul Bilnoski - 10 Jul 2005 16:14 GMT
> 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
Owen Jacobson - 10 Jul 2005 23:11 GMT
> 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.)