Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-17
10
Medium Priority
?
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 14

Expert Comment

by:B_Dorsey
ID: 18741748
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
ID: 18741765
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
ID: 18741782
It is not a standard line break - it appears as a "box" in SQL Server.

I'll do a screenshot.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:mrduckers
ID: 18741846
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
ID: 18741871
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
 
LVL 14

Expert Comment

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

Expert Comment

by:b0lsc0tt
ID: 18741917
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
ID: 18741930
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 1000 total points
ID: 18741936
>>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
ID: 18742191
acp: It was, I just did a replace on the field before constructing the csv and it works.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

705 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