Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
- - 10 Jul 2005 11:33 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".
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.)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.