Invalid line break character in textarea data capture breaks my csv extract tools

HI,

I have various text area fileds in different forms.

Every now and then someone enters data which creates a funny line break character. It comes out as a rectangular box in SQL Server.

Although the data capture looks ok when viewed in HTML, if i build a CSV extract tool it breaks the record. When the CSV file approaches this line break, it breaks teh CSV extract because it thinks it is a new line.

Is there a way around this but converting the textarea data as it is being captured, or while it is being written to a CSV file?

Thanks.
mrduckersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

B_DorseyCommented:
sample output of the data would help.. then we could probably grab what the character code is....

Could be a mozilla textarea submit... sometimes they output different
0
Anthony PerkinsCommented:
If it is a line feed consider doing a replace as follows:
Replace(YourTextArea, vbLf, vbNullString)

If it is a carriage return + line feed consider doing a replace as follows:
Replace(YourTextArea, vbCrLf, vbNullString)
0
mrduckersAuthor Commented:
It is not a standard line break - it appears as a "box" in SQL Server.

I'll do a screenshot.
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

mrduckersAuthor Commented:
Here is the sample.
http://www.trancorponline.com.au/sample.gif

I can't paste the test here because the boxes dissaper and turn into line breaks.
0
B_DorseyCommented:
its to bad you couldnt reproduce the problem cause then you could escape the data into the db or serverHTML encode it... atleast you could find the character that is producing it.
0
B_DorseyCommented:
can you try escaping the data on output and see what it does or serverhtmlencode on output?
0
b0lsc0ttIT ManagerCommented:
You could try sending the output through the code below.  It will look at each character and show the ASCII chracter code in brackets.  In the code strTest is the variable that has the output.

Dim i   ' Code to find character values
For i = 1 to Len(strTest)
   Response.Write Asc(Mid(strTest, i, 1)) & "[" & Mid(strTest, i, 1) & "], "
Next

The suggestion to use Server.HTMLEncode(str) on all data before it is entered in the database is a good idea to try to avoid this.

Let me know how it works or if you have a question.

bo
0
b0lsc0ttIT ManagerCommented:
One other thought is to look at the browser source (View Source).  There may be a clue to the character in the source that the browser either ignores or interprets wrong.

bol
0
Anthony PerkinsCommented:
>>It is not a standard line break - it appears as a "box" in SQL Server.<<
I suspect you will find that it is a Lf or CrLf.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrduckersAuthor Commented:
acp: It was, I just did a replace on the field before constructing the csv and it works.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.