ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 23rd, 2008, 08:49 AM
JiggyMF JiggyMF is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 JiggyMF User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 44 sec
Reputation Power: 0
Hidden characters (linebreaks) in string?

I have the following problem.

Some misc info about the project:
I send a request to one of our customer's webservice, which replies me with an XML document. Using this XML document i generate a simple report. This report is generated in HTML, we have chosen not to use crystal reports and the likes due to performance decrease and because the report that has to be shown is so simple it's as easy to generate it in HTML myself.

now for the problem
I receive an XML file from one of our customers webservice.
Within this xml file i receive from the webservice i send my request to, I have a section with the following:

<comment>20-03-2008
Issue 12345 handled
Issue 12345 closed

28-03-2008
Issue 12345 handled
Issue 12345 closed
</comment>

Now i generate some sort of report, in HTML.

I read the <comment> tag into a string.
I use the string in my report, and that’s where the misery starts. The HTML gives an error and can’t show.

When i view the source, i see the following(line containing the error is red)

<table>
<tr>
<td>20-03-2008
Issue 12345 handled
Issue 12345 closed

28-03-2008
Issue 12345 handled
Issue 12345 closed
</td>
</tr>
</table>

When i test with parts of the string, the error always seems to occur at the place where in the original XML file had a linebreak.
After some testing and debugging, I found out, that the error is likely because of hidden linebreaks in the string. When I look at the string when debugging, it just shows as a normal linear string, no weird chars.
However when I copy the string and paste it in word for example, it suddenly shows the text with the linebreaks as it was in the xml comment. If for example I copy the string manually while debugging and make a variable, which I then paste the string in, and use this string as the source for the HTML, then it does not give an error (although when comparing the string textually, it is the exact same thing).

My problem is, that it would be fine for me to either remove the hidden linebreaks, or to alter the string so that it does show in HTML without errors.
I tried everything I could think of, looked for vbClRf etc but I just can’t find what causes the linebreaks in the first place, let alone how to remove it.
Other then that I don’t really have any clue atm, since the linebreaks don’t show visually appear in my string (i can not syntaxicly see them nor have i been able to see them by converting to whatever i came up with).

Any help appreciated is greatly appreciated.

Reply With Quote
  #2  
Old April 25th, 2008, 01:38 AM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Click here for more information. Click here for more information
 
Join Date: Apr 2008
Posts: 300 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 2 h 48 m 27 sec
Reputation Power: 1
Most likely the issue is that the XML has either a CR (CHR(13)) or a LF (CHR(10)) but not both so vbCRLF isn't true.

You can check for either of these seperately or just assume that there's some weird character and rebuild the string replacing anything that isn't alphanumeric with a space or whatever.

Reply With Quote
  #3  
Old April 25th, 2008, 04:57 AM
JiggyMF JiggyMF is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 JiggyMF User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 44 sec
Reputation Power: 0
Quote:
Originally Posted by dykebert
Most likely the issue is that the XML has either a CR (CHR(13)) or a LF (CHR(10)) but not both so vbCRLF isn't true.

You can check for either of these seperately or just assume that there's some weird character and rebuild the string replacing anything that isn't alphanumeric with a space or whatever.


You were spot on!
I checked for a vbCrLf only when trying to find it.
I tried checking for both vbCr and vbLf now also and it turned out it contains vbCr.
Your help was much appreciated, thanks alot

Regards

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Hidden characters (linebreaks) in string?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT