carriage return in hex 0D

Discussion in 'Java' started by Patricia Smith, Jan 15, 2007.

  1. Hi,

    I need some help in writing Java code in representing carriage returns
    in Hex 0D. I've written a program in Java on an Unix system that
    passes data to a Stratus machine via TCP/IP socket. The data I send to
    the Stratus box needs to have carriage returns in it, which I've
    written in Java as "\r", but the Stratus box does not seem to
    recognize it. It is expecting a hex 0D instead.

    Does anyone know how to code in Java to pass a hex 0D?

    Thanks in advance for any advice you can provide.

    Pat
     
    Patricia Smith, Jan 15, 2007
    #1
    1. Advertising

  2. Patricia Smith

    Lew Guest

    Patricia Smith wrote:
    > Does anyone know how to code in Java to pass a hex 0D?


    (followup set to clj.help)

    From the Java Language Specification (JLS)
    <http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089>:

    3.10.6 Escape Sequences for Character and String Literals
    ....
    EscapeSequence:
    ....
    \ r /* \u000d: carriage return CR */

    You want to send the '\r' character. Your encoding (ASCII, ISO-8859-1, UTF-8,
    ....) may matter.

    - Lew
     
    Lew, Jan 15, 2007
    #2
    1. Advertising

  3. Patricia Smith wrote:
    > I need some help in writing Java code in representing carriage returns
    > in Hex 0D. I've written a program in Java on an Unix system that
    > passes data to a Stratus machine via TCP/IP socket. The data I send to
    > the Stratus box needs to have carriage returns in it, which I've
    > written in Java as "\r", but the Stratus box does not seem to
    > recognize it. It is expecting a hex 0D instead.
    >
    > Does anyone know how to code in Java to pass a hex 0D?


    [why not limit the number of newsgroups you post to a bit ?]

    \r is a CR (hex 0D).

    The syntax for using hex in strings are

    "xx\u000Dxx"

    but "xx\rxx" should do the same.

    Can you post a little code snippet on how you setup
    the string and write it to the socket ?

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jan 15, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    6,406
    Neredbojias
    Aug 19, 2005
  2. Bengt Richter
    Replies:
    6
    Views:
    534
    Juha Autero
    Aug 19, 2003
  3. jack
    Replies:
    4
    Views:
    616
  4. Xeno Campanoli
    Replies:
    0
    Views:
    247
    Xeno Campanoli
    Feb 13, 2006
  5. Steve Anderson
    Replies:
    3
    Views:
    282
    Steve Anderson
    Jun 21, 2004
Loading...

Share This Page