Solved

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

Posted on 2007-03-17
10
351 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:mrduckers
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 14

Expert Comment

by:B_Dorsey
Comment Utility
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
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
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
 

Author Comment

by:mrduckers
Comment Utility
It is not a standard line break - it appears as a "box" in SQL Server.

I'll do a screenshot.
0
 

Author Comment

by:mrduckers
Comment Utility
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
 
LVL 14

Expert Comment

by:B_Dorsey
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 14

Expert Comment

by:B_Dorsey
Comment Utility
can you try escaping the data on output and see what it does or serverhtmlencode on output?
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
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
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
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
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
Comment Utility
>>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
 

Author Comment

by:mrduckers
Comment Utility
acp: It was, I just did a replace on the field before constructing the csv and it works.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now