HJW
HJW

Reputation: 23443

How to simulate carriage return (HEX 0A) in ASCII or normal text?

i am required to simulate a carriage return (0A) to save into the database from a web application so that i can prove that the system is not cleaning data causing some issues, this needs to be entered in the browser as a plain text, are we able to do this?

Upvotes: 1

Views: 31741

Answers (3)

Wouter
Wouter

Reputation: 1987

From this question: What character represents a new line in a text area

By HTML specifications, browsers are required to canonicalize line breaks in user input to CR LF (\r\n).

Hence, you can't insert any other style of newline through a browser.

Upvotes: 0

user2361622
user2361622

Reputation: 11

Line feed char(10) is correct

Carriage return char(13) is giving issues.

Upvotes: 1

kazinix
kazinix

Reputation: 30123

I don't know what you are trying to achieve, but here's an article that uses CHAR() function in SQL query http://msdn.microsoft.com/en-us/library/ms187323.aspx

insert into mytable(mytext) values('Dear Sir:' + CHAR(13)+CHAR(10) + 'This is')

Line feed char(10)

Carriage return char(13)

Upvotes: 2

Related Questions