1

I am trying to learn encoding, so please bear with me.

Using an online encoding tool such as this one, I can see that the data

a
b

can be represented

in Ascii/ANSI as:

a
b

in Hex as:

610d0a62

in base64 as:

YQ0KYg==

But in Java if I need to print this data to the screen I need to use the command

System.out.println("a\r\nb");

What form of encoding is \r\n?

In other words, is it fair to say that \r\n is the keyboard representation for the ascii

a
b
1
  • Are you asking about what type of encoding escape sequences are? Or are you trying to encode those escape sequences into something? Commented Jul 9, 2015 at 23:03

1 Answer 1

1

It's not a real encoding, is an escape character + a character.

It is used to define common ASCII characters which are not printable. The list available to Java is here.

Basically \r is interpreted as the value 0x0D or 13 in decimal, which is the carriage return.

Sign up to request clarification or add additional context in comments.

2 Comments

Is it fair to say that \r is the keyboard representation of \u0x0D
It's just a norm chosen many years ago when they required to give a textual representation to ASCII values that didn't have one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.